We have introduced transitions in Chapter 3, Building Our First Game – Breakout, and briefly touched base with it. Let's go into more detail.
The transition library allows you to create animations with only a single line of code by allowing you to tween one or more properties of a display object. We have discussed the basics of transitions back in Chapter 3, Building Our First Game – Breakout.
This can be done through the transition.to
method, which takes a display object and a table that contains the control parameters. The control parameters specify the duration of the animation and the final values of properties for the display object. The intermediate values for a property are determined by an optional easing function, which is also specified as a control parameter.
The transition.to()
method animates a display object's properties over time, using the "easing" algorithm.
The syntax is handle = transition.to( target, params )
.