Game Development Reference
Easing package classes and methods
The property that actually does the job of animating the object is the bqj_ property. In the example,
this is Nacqh]n*a]oaEjKqp. It's highlighted in bold in the following code:
[psaaj9jasPsaaj$nk^kp(t( Nacqh]n*a]oaEjKqp (nk^kp*t(01,( ±
Nacqh]n, a class in the a]oejc package, contains a method called a]oaEjKqp. a]oaEjKqp eases the
object into the animation and then eases it to a gradual stop.
The Nacqh]n class contains two more methods:
a]oaEj: Accelerates the object and stops it abruptly
a]oaKqp: Starts the object abruptly and gradually slows it down
The best way to understand how this works is to see its actual effect on the stage:
1. Open the >]oe_Psaaj folder as a project if it isn't already open.
2. Double-click the I]ej[>]oe_Psaaj*]o file so it opens in the workspace.
3. Change the constructor method so that it looks like this:
[psaaj9jasPsaaj$nk^kp(t( Nacqh]n*a]oaKqp (nk^kp*t(01,( ±
4. Save the I]ej[>]oe_Psaaj*]o file and test the project. The robot starts quickly and gradually
5. Change the code again so it looks like this:
[psaaj9jasPsaaj$nk^kp(t( Nacqh]n*a]oaEj (nk^kp*t(01,( ±
6. Save the I]ej[>]oe_Psaaj*]o file and test the project. The robot gradually speeds up and
The motion isn't dependent on an AJPAN[BN=IA event. Although the animation hap-
pens within the context of the movie's frame rate, it's completely orchestrated by the
Psaaj object. This is helpful because you can initialize different Psaaj objects con-
taining different animations, stop them with the opkl method, and trigger them with
a op]np method whenever you need them in your program.