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.

Overwriting tweens in TweenLite

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

You can choose to overwrite tweens:

1
2
TweenLite.to(mc, 1, {x:100, y:200});
TweenLite.to(mc, 1, {x:300, overwrite:2}); //only overwrites the "x" property in the previous tween

you can pass 0, 1, 2, or 3 to overwrite.

According to GreenSock’s site:

0 (NONE): No tweens are overwritten. This is the fastest mode, but you need to be careful not to create any tweens with overlapping properties, otherwise they’ll conflict with each other.

1 (ALL): (this is the default unless OverwriteManager.init() has been called) All tweens of the same object are completely overwritten immediately when the tween is created.

2 (AUTO): (used by default if OverwriteManager.init() has been called) Searches for and overwrites only individual overlapping properties in tweens that are active when the tween begins.

3 (CONCURRENT): Overwrites all tweens of the same object that are active when the tween begins.


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 
}