The Translation class animates a value by continuously calling the onUpdate function.

Use one of the predefined Transition functions to control the progress of the animation (linear, easeInQuadratic, easeInCubic, ...). If none of the predefined Transition functions fulfills your needs you can also define your own function (see TransitionFunction).

Examples:

var translation = new Translation(0.0, 100.0, 1.0, Transition.linear);
translation.onUpdate = (value) => print('the value changed to $value');
renderLoop.juggler.add(translation);

var transition = Transition.easeInOutQuadratic;
stage.juggler.addTranslation(0.0, 100.0, 1.0, transition, (v) {
  print('the value changed to $v'));
});
Implements
  • Animatable

Constructors

Translation(num startValue, num targetValue, num time, [ TransitionFunction transition = Transition.linear ])

Creates a new Translation.

Properties

currentTime → num

The current time of this Animation.

read-only
currentValue → num

The current value.

read-only
delay → num

The delay before the translation actually starts.

read / write
hashCode → int

Get a hash code for this object.

read-only, inherited
isComplete → bool

Indicates if this Translation is completed.

read-only
onComplete

The function that is called when this Translation is completed.

write-only
onStart

The function that is called when this Translation starts.

write-only
onUpdate

The function that is called every time this Translation updates the value.

write-only
roundToInt → bool

Specifies if the values should be rounded to an integer.

read / write
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited
startValue → num

The starting value to animate from.

read-only
targetValue → num

The value to animate to.

read-only
totalTime → num

The total time of this Animation.

read-only

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

advanceTime(num time) → bool

This method is called by the Juggler with the time past since the last call.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() → String

Returns a string representation of this object.

inherited