Animates a value between the two specified numbers over the specified duration. Calls the specified callback function with the current value at each step of the animation. Returns an animation object that can be used to end the animation early.
Methods
Argument | Description |
---|---|
cancel() | Same as complete() but the callback is never called with the target value. |
complete() |
Called automatically at completion of animation. Calls the value callback one last time with the target value and Calls onComplete function if specified and removes the animator from the queue |
Parameters
Argument | Type | Description |
---|---|---|
q | Object | Animation queue to use to run the animation. |
animationType | String | Can be linear, bezier, zeno. Determines the rate of animation throughout its duration |
callback | Function | Called each step of the animation as the value changes. Argument: Current value |
details | Object | Object containing additional properties (optional) |
Properties for details object:
Argument | Type | Description |
---|---|---|
onComplete | Function | Function called when animation is complete. Arguments include animated element and boolean canclled value. |
reverse | Boolean | True causes animation to run in reverse. |
curve | Constant | Specifies the animation curve type. Default is linear. Other options include standard curves or an array of coordinates for control points of a cubic bezier curve. |
from | Number | Starting value of number |
to | Number | Ending value of number |
duration | Number | Duration of animation in seconds. |
currentValue | Number | Starting value for number. Can be used to resume partially complete animations or reverse cancelled animations. |
0 Comments