Game Development Reference
In-Depth Information
lq^he__h]ooI]ej[>]oe_Psaajatpaj`oIkrea?hel
w
++@a_h]nar]ne]^hao
lner]par]n[psaaj6Psaaj7
lq^he_bqj_pekjI]ej[>]oe_Psaaj$%
w
++?na]pa]jejop]j_akbpdaPsaaj_h]oo
[psaaj9jasPsaaj$nk^kp(t(Nacqh]n*a]oaEjKqp(nk^kp*t(01,( ±
2,(b]hoa%7
y
y
y
To use the Psaaj class, you need to import some new packages and classes into the I]ej[>]oe_Psaaj
class. The Psaaj class and the a]oejc package that contains the formulas create the easing effects:
eilknpbh*pn]joepekjo*Psaaj7
eilknpbh*pn]joepekjo*a]oejc*&7
You might be wondering what the asterisk is doing after the dot in the directive that imports the
a]oejc package. It instructs the program to import every class in the a]oejc package. Normally you
would not want to do this. For matters of clarity, it's usually best just to import the classes you need,
but in this case, there are a lot of classes in the a]oejc package that you'll want to experiment with,
so it saves you a bit of trouble of having to import them one at a time.
In the preceding class, an instance of the Psaaj class called [psaaj was created. You need to provide
the Psaaj class with six parameters when you create a new Psaaj instance:
[psaaj9jasPsaaj$nk^kp(t(Nacqh]n*a]oaEjKqp(nk^kp*t(01,( ±
2,(b]hoa%7
As you can see, it's packed with information. It might look a bit disorienting at first glance, but it's
pretty straightforward if you break down the arguments it contains one piece at a time. Figure 10-10
is a diagram that explains what the information in the arguments represents.
Whether to use frames
or seconds for the
animation's duration. If
false, the duration will
be in frames.
The object you
want to animate.
The effect that you want to
use to animate the object.
The object's
final position.
[psaaj9jasPsaaj$nk^kp(t(Nacqh]n*a]oaEjKqp(nk^kp*t(01,(2,(b]hoa%7
Name of the
Tween object.
The object's property that
you want to animate.
The object's
start position.
The duration of the
animation in frames
or seconds.
Figure 10-10. The arguments you need to supply to create a new Tween instance
As you can see, it's really just a detailed list of information that the Psaaj object needs to create the
animation.
 
Search Nedrilad ::




Custom Search