She walks in beauty like the night // Hypnotising the silence with her powers // Armageddon is bedding this picture alright // My Marilyn come to slum for an hour. An actionscript and music blog.

Easy tweens with TweenLite

Posted: February 13th, 2009 | Author: Janice | Filed under: Uncategorized | Tags: , , | No Comments »

TweenLite is a small and fast tweening engine for Flash Player 9 (AS3). TweenLite only adds about 3KB to published .swfs.

Somewhere above your constructor:

1
2
import gs.TweenLite; 
import gs.easing.*;

Basic TweenLite function:

TweenLite.to tweens from an initial point to that point that you define. Position the clip on the stage where/how you want the tween to start.

1
2
TweenLite.to(circle, 1, {x:300, ease:Sine.easeIn}); 
// TweenLite.to(moviecliptotween, timeinsec, { .. properties... });

TweenLite.from does the opposite. Position the clip on the stage where you want the tween to end, and define where/how you want the tween to begin:

1
TweenLite.from(circle, 1, {y:300, ease:Sine.easeIn});

Useful notes:

TweenLite has an onComplete function that you can map behaviour to upon finishing a tween.

1
2
3
4
5
TweenLite.to(circle, 1, {onComplete:doneTween};
...
function doneTween():void {
   // finished tween, now do this 
}


Leave a Reply