|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Moving things with AS in general.
Hey,
A while ago on orisinal.com i saw a neat bit of Flash...a sentence, with the letters made up of individual pixels. When you roll your mouse over the letters, they exploded out into their component pixels, which then zoomed back together when you move your mouse away. I've recently bought O'Reilly's book on ActionScript which has given me the basics of how this could be done, but I have a slight problem...I can get an object to move to a given point with AS, but I'm not sure how to get it to ANIMATE to that point - it just jumps from one point to another. I want it to smoothly animate. I think I need to do something with looping, but I'm not sure..can anyone help? P.S. In pseudo-code I'm doing this to move the objects: On start, get original pixel x/y values and store On mouseover, generate random number and change x and y to this value. On mouseout, set x and y to original values. It's just a matter of animating them as such! Thx |
|
#2
|
|||
|
|||
|
Here's an example using Penner's easing equations.
Frame 1: Code:
Math.easeInOutQuad = function (time, beginX, changeX, durationX) {
if ((time/=durationX/2) < 1) return changeX/2*time*time + beginX;
return -changeX/2 * ((--time)*(time-2) - 1) + beginX;
};
time = 0;
beginX = myMC._x;
changeX = 300;
durationX = 20;
function movement(){
_root.myMC.onEnterFrame = function() {
trace("called");
if (time<=durationX) {
this._x = Math.easeInOutQuad(time, beginX, changeX, durationX);
} else {
_root.myMC.onEnterFrame = null;
}
time++;
}
};
button: Code:
on (release) {
movement();
}
Check out http://www.robertpenner.com/easing/ for more examples. Good luck!!! |
|
#3
|
|||
|
|||
|
Thanks...that's a little more complex than I wanted to get really, I just want to move the object, easing isn't important as such. I've got the movement working fine - it just jumps. I want to see the movement as if it had been tweened. Is there a simpler way?
Cheers. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Moving things with AS in general. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|