Constructor
new CanvasAnimation()
Members
animations :Object.<string, CanvasAnimationData>
Track an object of active animations by name, context, and function This allows a currently playing animation to be referenced and terminated
Type:
- Object.<string, CanvasAnimationData>
Methods
(async, static) animateLinear(attributes, options) → {Promise}
Apply a linear animation from the current value of some attribute to a new value Resolve a Promise once the animation has concluded and the attributes have reached their new target
Example
let animation = [
{
parent: token,
attribute: x,
to: 1000
},
{
parent: token,
attribute: y,
to: 2000
}
];
CanvasAnimation.animateLinear(attributes, {duration:500, ontick: console.log("ticking")});
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
attributes |
Array.<object> | An array of attributes to animate. Structure of the Array is shown in the example |
|||||||||||||||||||||||||
options |
object | Additional options which customize the animation Properties
|
Returns:
A Promise which resolves once the linear animation has concluded
- Type
- Promise
(static) getAnimation(name) → {CanvasAnimationData}
Retrieve an animation currently in progress by its name
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The animation name to retrieve |
Returns:
The animation data, or undefined
- Type
- CanvasAnimationData
(static) terminateAnimation(name)
If an animation using a certain name already exists, terminate it
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The animation name to terminate |