Created
November 15, 2012 02:29
-
-
Save prime31/4076270 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a TweenConfig that we will use on all 4 cubes | |
var config = new TweenConfig() | |
.setEaseType( EaseType.QuadIn ) // set the ease type for the tweens | |
.materialColor( Color.magenta ) // tween the material color to magenta | |
.eulerAngles( new Vector3( 0, 360, 0 ) ) // do a 360 rotation | |
.position( new Vector3( 2, 8, 0 ), true ) // relative position tween so it will be start from the current location | |
.setIterations( 2, LoopType.PingPong ); // 2 iterations with a PingPong loop so we go out and back | |
// create the chain and set it to have unlimited iterations | |
var chain = new TweenChain().setIterations( -1 ); | |
// add a completion handler for the chain | |
chain.setOnCompleteHandler( c => Debug.Log( "chain complete" ) ); | |
// create a Tween for each cube and it to the chain | |
foreach( var cube in cubes ) | |
{ | |
var tween = new Tween( cube, 0.5f, config ); | |
chain.append( tween ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment