|
Timeline
Description of timelines and their options.
Featured IntroductionA Timeline can be used to sequence multiple tweens. They will be automatically delayed so they can be executed one after the other.
Using a TimelineThe following example will move the target horizontal position from its current location to x=200, then from x=200 to x=0, and finally from x=0 to x=500, but this last transition will only occur 1000ms after the previous one. Timeline.createSequence()
.push(Tween.to(myObject, POSITION_X, 0.5f).target(200))
.push(Tween.to(myObject, POSITION_X, 0.5f).target(0))
.pushPause(1.0f)
.push(Tween.to(myObject, POSITION_X, 0.5f).target(500))
.start(myManager);Nested timelinesTimelines can nest tweens but also other timelines. For instance: Timeline.createSequence()
// First, set all objects to their initial positions
.push(Tween.set(...))
.push(Tween.set(...))
.push(Tween.set(...))
// Wait 1s
.pushPause(1.0f)
// Move the objects around, one after the other
.push(Tween.to(...))
.push(Tween.to(...))
.push(Tween.to(...))
// Then, move the objects around at the same time
.beginParallel()
.push(Tween.to(...))
.push(Tween.to(...))
.push(Tween.to(...))
.end()
// And repeat the whole sequence 2 times
.repeatYoyo(2, 0.5f)
// Let's go!
.start(myManager);OptionsMany options can be added to your timelines. Most of these optional methods return the current timeline, so you can chain them in one line.
Of course, nested timelines also support all these options. |
► Sign in to add a comment