Implement an animator object that change values over time using Linear Interpolation. Usage example: (new Animator(sprite)).from({‘position.x’: 0}).to({‘position.x’: 100}).duration(1).play();
Kind: global class
Boolean
Animator
Animator
Animator
Animator
Animator
Animator
Animator
Animator
Animator
Create the animator.
Param | Type | Description |
---|---|---|
target | \* |
Any object you want to animate. |
Speed factor to multiply with delta every time this animator updates.
Kind: instance property of Animator
Boolean
Get if this animator finished.
Kind: instance property of Animator
Returns: Boolean
- True if animator finished.
Update this animator with a given delta time.
Kind: instance method of Animator
Param | Type | Description |
---|---|---|
delta | Number |
Delta time to progress this animator by. |
Animator
Set a method to run when animation ends.
Kind: instance method of Animator
Returns: Animator
- this.
Param | Type | Description |
---|---|---|
callback | function |
Callback to invoke when done. |
Animator
Set smooth damp. If true, lerping will go slower as the animation reach its ending.
Kind: instance method of Animator
Returns: Animator
- this.
Param | Type | Description |
---|---|---|
enable | Boolean |
set smooth damp mode. |
Animator
Set if the animator should repeat itself.
Kind: instance method of Animator
Returns: Animator
- this.
Param | Type | Description |
---|---|---|
enable | Boolean | Number |
false to disable repeating, true for endless repeats, or a number for limited number of repeats. |
reverseAnimation | Boolean |
if true, it will reverse animation to repeat it instead of just “jumping” back to starting state. |
Animator
If true, will reverse animation back to start values after done.
This is equivalent to calling repeats(1, true)
.
Kind: instance method of Animator
Returns: Animator
- this.
Animator
Set ‘from’ values. You don’t have to provide ‘from’ values, when a value is not set the animator will just take whatever was set in target when first update is called.
Kind: instance method of Animator
Returns: Animator
- this.
Param | Type | Description |
---|---|---|
values | \* |
Values to set as ‘from’ values. Key = property name in target (can contain dots for nested), value = value to start animation from. |
Animator
Set ‘to’ values, ie the result when animation ends.
Kind: instance method of Animator
Returns: Animator
- this.
Param | Type | Description |
---|---|---|
values | \* |
Values to set as ‘to’ values. Key = property name in target (can contain dots for nested), value = value to start animation from. |
Flip between the ‘from’ and the ‘to’ states.
Kind: instance method of Animator
Animator
Make this Animator update automatically with the gameTime delta time. Note: this will change the speedFactor property.
Kind: instance method of Animator
Returns: Animator
- this.
Param | Type | Description |
---|---|---|
seconds | Number |
Animator duration time in seconds. |
Animator
Reset animator progress.
Kind: instance method of Animator
Returns: Animator
- this.
Animator
Make this Animator update automatically with the gameTime delta time, until its done.