Search code examples
javalibgdxtween

Universal Tween Engine Serial sequence


I need to create a sequence where we have the following;

object 1 moves from point A to point B in 2 seconds at the same time, object 2 moves from point c to D in one second, and serial to that, object 3 moves from F to G in one second.

As you can see. This needs the following chain

Timeline.createSequence()
.beginParallel()
    .push( Tween.set( 1 , XY ).target( B )
    .begingSerial() 
        .push( Tween.to( 2, XY).target( D )
        .push( Tween.to( 3, XY).target( G )
    .end()
.end()

But "beginSerial()" does not exists. How do I do this ?


Solution

  • You can always push another TimeLine into the original TimeLine.

    Timeline.createSequence()
    .beginParallel()
        .push( Tween.set( 1 , XY ).target( B )
        .push( Timeline.createSequence()
            .push( Tween.to( 2, XY).target( D )
            .push( Tween.to( 3, XY).target( G )
        .end() )
    .end()
    

    Hope this helps.
    Good Luck.