Java Reference
In-Depth Information
// at 10 seconds, set x/y to target value
at(10s) {
x => 1000 tween Interpolator.LINEAR;
y => 1000 tween Interpolator.LINEAR;
}
]
};
// play from current position, which at start is 0
timeline. play ();
timeline. pause ();
// pause
timeline. play ();
// resume at pause point
timeline. pause ();
timeline. time = 1s; // set the current time to 1 second
timeline. play (); // resume play at 1 second
// stop and reset start time to the Start Time
timeline. stop ();
When the timeline plays, it starts, by default, at time zero; then, while it progresses
to the next specified time (10 seconds in the preceding example), the interpola-
tors for each target value are repeatedly invoked so that the animation can provide
a smooth transition from the original value to the final target value. The runtime
system decides how to break up the interval between key frames in order to have
smooth movement; however, this can be influenced by load and capabilities of
the client's machine. Insufficient compute power may result in jerky animations.
The function play() starts the timeline from its current position. There is also a
playFromStart() function that always starts at the initial position. The func-
tion, pause() , stops the play at the current position, and a subsequent play()
resumes the timeline from that position. Finally, the stop() function stops the
play and resets the timeline to the initial position.
By default, autoReverse is turned off, so the timeline only progresses forward,
repeatCount is 1.0, so that the timeline only cycles once, and the rate is 1.0, so
the animation runs at normal speed.
You can examine several instance variables to determine the current state of the
timeline. First, the instance variable, running , indicates whether the timeline has
been started or stopped. Notice that a paused timeline is still in the running state,
but the paused instance variable is true. To detect that the timeline is playing, it
is necessary to check running for true and paused for false.
The currentRate instance variable indicates the current speed and direction of play.
A negative currentRate indicates the timeline is playing backwards. Therefore, if
 
Search WWH ::




Custom Search