Animation
There are different kinds of animations that you might want to do. Some require a constant timeline that will animate something over a longer period of time. This could be a normal game loop where you would move objects around, calculating the new step values yourself. Other animations could be short animations that might happen as a response to something for example. That is what this module is for. It is very simple to use, and you don't have to calculate the step values yourself, just specify the end values and a duration. It also accepts a few different easing functions.
The properties listed below exist on the animation module, core.animation.durations
for example. The methods exist on display objects.
Methods
- animate()
- delay() (since version 2.2.0)
- fadeIn()
- fadeOut()
- fadeTo()
- finish() (since version 2.0.0)
- stop()
Properties
- defaults : Object
- Contain default values for duration and easing.
- duration : String
- The default duration. Must be one of the duration names that exist in the
durations
object. - easing : String
- The default easing. Must be one of the easing names that exist in the
easing
object.
- durations : Object
- Contains predefined duration values. The property names are the duration names and the values are the number of milliseconds.
- easing : Object
- Contains all predefined easing functions. These are "ease-in", "ease-out", "ease-in-out", "linear" and a generic cubicBezer function. The last one is not used directly, but is a helper function for the other easing functions. Each easing function gets passed one argument, the position in time for the running animation. This is a percentage from 0 to 1.