Skip to content

TweenParty: Multiple, Simultaneous Tweens

Mike edited this page Apr 22, 2015 · 4 revisions

The TweenParty class lets you take a series of tweens and control them all from a single object. You can add as many other tweens as you would like to the TweenParty and it will simultaneously run all the tweens. Now, it's not all fun and games at the party. There are a couple important items to take note of when using a TweenParty:

  • the delay, loop and ease/animation curve should be set on the TweenParty
  • all sub-tweens added to the TweenParty will have their duration reset to the duration of the TweenParty (any delays or loops will also be nullified on sub-tweens).

Here is an example of a TweenParty animating a color and a position with a ping-pong loop thrown in for good measure:

var party = new TweenParty( 0.5f );
party.addTween( quad.GetComponent<Renderer>().material.ZKcolorTo( Color.black, 0.5f ) );
party.addTween( quad.ZKpositionTo( new Vector3( 7f, 4f ), 0.5f ) );
party.setEaseType( EaseType.QuartOut )
	.setLoops( LoopType.PingPong )
	.start();

Clone this wiki locally