-
Hey everyone!
Just a small probelm: I'm doing some things in actionscript that require tweeing..... anyone know of a quick mathematical formula that will give me values that increase like a tween (ie small increments to large increments of gain) for example, an equation that
produces something akin to 1, 1.5, 2.5, 4, 6, 9, 13
etc.
But the thing is I;d like to be able to control the factor of inscrease..... say I want the values to jump sharply after a certain time, akin to tweening in or out...
- Thanks!
-
here's what you would do to have something like a tween with an ease out. (slowing down)
//first declare your starting destination points
onClipEvent(load) {
x = 250;
y = 250;
//then declare your divisor that can be adjusted to your liking
divisor = 10;
}
onClipEvent (enterFrame) {
//put you x and y positions of the mc in variables
Xpos = clip._x;
Ypos = clip._y;
//find the distance between where you want to go and where you are
distX = x - Xpos;
distY = y - Ypos;
//find the rate or increment to move the clip
incX = distX/divisor;
incY = distY/divisor;
//move the clip
clip._x += incX;
clip._y += incY;
}
Now this will move it and slow it down as it approaches its destination. Speeding it up as it appraoches its target is something I haven't done but I think it would be basically the same idea but with some mathematical changes. Just mess around with this code and see what happens.
Dan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|