|
|
|
import mx.transitions.Tween;
import mx.transitions.easing.*;
new Tween(ball_mc, "_y",
Bounce.easeOut, ball_mc._y, 250, 3, true);
new Tween(ball_mc, "_x", Regular.easeOut,
ball_mc._x, 400, 4, true);
|
Note: Press
the "refresh" button in the browser to play the animation
again. |
// The tween transition class is imported.
import mx.transitions.Tween;
// This uses the "wilcard"
symbol "*" to imaport all six of the
easing classes in a package.
// This package contains multiple classes in a single directory folder.
import mx.transitions.easing.*;
// A new tween is contructed
and defined using the tween class syntax:
// Tween (object, property, function, begin, end, duration, useSeconds).
new Tween(ball_mc, "_y", Bounce.easeOut,
ball_mc._y, 250, 3, true);
// The object being tweened
is ball_mc.
// The property "_y" indeicates
the vertical position of the movie clip is
to be tweened.
// Bounce indicates that the
ball will bounce moving up and down and reducing
its height after each bounce.
// easeout dicates to the
movie clip that its motion deccelerates toward
the end of the transition.
// ball_mc_y sets the initial
position of the movie clip Ball_mc as the stating
point for the transition.
// 250 sets the final coordinates
of the movie clip.
// 3 sets the duration of
the animation to 3 units.
// true uses boolean logic
to set the units for the duration fo the tween
to seconds.
// This transition acts only on the horizontal
position of the movie clip.
new Tween(ball_mc, "_x", Regular.easeOut,ball_mc._x,
400, 4, true);
// Regular.easeOut Sets the movie clip to gently
deccelerate toward the end of the transition.
// This subtle easing gives the effect of
friction slowing the ball horizontally.
// note that the horizontal motion continues for
an extra second. This gives a simple slide effect.
|