Tween A Number with GreenSock’s Tweening Class

I am going to give you a little example on how to tween a number. This example can be used with other tweening classes as well like Caurina’s Tweener.

Pay attention that the variable we want to tween needs to be public otherwise you’ll get an error compiling the code.

We are going define a variable as an Object. This object will hold a value. The tweener will tween this object’s value.

public var my_number :Object  =  { value: 0 };
TweenLite.to( this.my_number,  .5, { value: 100 , onUpdate:function(){ trace (this.value); } } )

 

Advertisements

One thought on “Tween A Number with GreenSock’s Tweening Class

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s