Tuesday, December 04, 2007

Creating the time rag using Tween.

People put cool intro type effect all the time but one of them that i was dying to do through actionscript was time rag. i mean if you look at http://www.2advanced.com for example you can see stuff at the bottom coming in at different timing.

well i finally found out how to do this with action script. i guess it can be done just by animating manually but usually for these kind of thing it's way faster and more acurate to do it via ActionScript.


var speed:Number = .5 * i+1;
var xTween:Tween = new Tween(pp, "x", Back.easeOut, -300, 30, speed, true);
xTween.start();

if you look carefully into it you see a variable i

well yes this is inside the for loop. and iterates for how ever many movie clips that's inside of an array. i was doing this for my new photo gallery i was building.

Here i'm giving a variable speed 0.5 * i + 1
0.5 * i expresses difference in time.
+ 1 is basically an offset value so that the element 0 or the first one will still show up. (0 * anything is 0 so speed or time it takes will be 0 - in Tween class term it means do nothing)

so putting all elements that you want time rags when showing up in an array and create for loop and tween all of them with a bit different speed.

well if you are going to do this for 100 elements it might not work...


I'm still searching for a way to do real time rag which just keeps pause before triggering animation..

maybe if you use eventListever for MOTION_FINISH and 2 tweens it will.

No comments: