RandomEffectController class
An EffectController that wraps another effect controller child and randomizes its duration after each reset.
This effect controller works best in contexts were it has a chance to be
executed multiple times, such as within a RepeatedEffectController
, or
InfiniteEffectController
, etc.
The child's duration is randomized first at construction, and then at each
reset (setToStart
). Thus, the child has a concrete well-defined duration
at any point in time.
- Inheritance
-
- Object
- EffectController
- RandomEffectController
- Mixed-in types
Constructors
- RandomEffectController(DurationEffectController child, RandomVariable randomGenerator)
- RandomEffectController.exponential(DurationEffectController child, {required double beta, Random? random})
-
Factory constructor that employs a random variable distributed
exponentially with rate parameter
beta
. The produced random values will have the average duration ofbeta
.factory - RandomEffectController.uniform(DurationEffectController child, {required double min, required double max, Random? random})
-
Factory constructor that uses a random variable uniformly distributed on
[min, max)
.factory
Properties
- child → DurationEffectController
-
Returns the wrapped child effect controller.
no setteroverride
- completed → bool
-
Has the effect already finished?
no setteroverride
- duration → double?
-
Total duration of the effect. If the duration cannot be determined, this
will return
null
. For an infinite effect the duration is infinity.no setteroverride - hashCode → int
-
The hash code for this object.
no setterinherited
- isInfinite → bool
-
Will the effect continue to run forever (never completes)?
no setterinherited
- isRandom → bool
-
Is the effect's duration random or fixed?
no setteroverride
- progress → double
-
The current progress of the effect, a value between 0 and 1.
no setteroverride
- randomGenerator → RandomVariable
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- started → bool
-
Has the effect started running? Some effects use a "delay" parameter to
postpone the start of an animation. This property then tells you whether
this delay period has already passed.
no setterinherited
Methods
-
advance(
double dt) → double -
Advances this controller's internal clock by
dt
seconds.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onMount(
Effect parent) → void -
This is called by the Effect class when the controller is attached to
that effect. Controllers with children should propagate this to their
children.
inherited
-
recede(
double dt) → double -
Similar to
advance()
, but makes the effect controller move back in time.override -
setToEnd(
) → void -
Puts the controller into its final "completed" state.
inherited
-
setToStart(
) → void -
Reverts the controller to its initial state, as it was before the start
of the animation.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited