Skip to content

TweenChain: Chaining a Series of Tweens Together

Mike edited this page Apr 23, 2015 · 3 revisions

The TweenChain class lets you run a series of tweens one after the other. In the example below the quad will have it's scale animated and when that completes the eulerAngles will be animated. Note that you can chain as many tweens together as you would like and they can act on completely different objects as well.

var chain = new TweenChain();
chain.appendTween( quad.ZKlocalScaleTo( new Vector3( 2f, 2f, 2f ), 0.5f ).setLoops( LoopType.PingPong ) )
	.appendTween( quad.ZKeulersTo( new Vector3( 0f, 0f, 180f ), 1f ).setLoops( LoopType.PingPong ) )
	.setCompletionHandler( t => Debug.Log( "TweenChain done: " + t ) )
	.start();

Clone this wiki locally