-
Notifications
You must be signed in to change notification settings - Fork 125
6. TweenFlows: Creating a Timeline of Tweens
TweenFlows give you timeline-like control over AbstractGoTweens (that includes GoTweens, other GoTweenChains and GoTweenFlows). For each AbstractGoTween that you add you get to choose the time that it starts. The example below will be just like the one for the GoTweenChain except we will start the scale tween when the moveTween is only halfway done. This shows how GoTweenFlows differ from GoTweenChains: the individual AbstractGoTweens can overlap each other.
It is important to note that GoTweenChains and GoTweenFlows start in the paused state so we call play to get it started in the example. Two important considerations are that the original GoTweens delay is not taken into account when played via a chain or flow and that any AbstractGoTween with its iterations set to infinite will not be added.
var moveTween = new GoTween( someTransform, 3f, new GoTweenConfig().position( new Vector3( 5, 5, 5 ) ) );
var scaleTween = new GoTween( someTransform, 3f, new GoTweenConfig().scale( 4f ) );
var flow = new GoTweenFlow();
flow.insert( 0, moveTween ).insert( 1.5f, scaleTween );
flow.play()