PDA

View Full Version : MX acceleration/deceleration of a movie clip?



georgia
February 19th, 2003, 11:04 AM
If anyone can help me with this question I would be very grateful.

I have a movie clip (1). When I click on 1, I would like to move a second clip (2) to another position along the x axis. This I know how to do. What I'm not sure of it how to code it to decelerate as it approaches it's final position.

Thanks

Georgia

pom
February 19th, 2003, 11:11 AM
Check the easing tutorial, Georgia. Everything's in there :)

pom :tie:

JGizmo
February 19th, 2003, 11:18 AM
Hi there,

Find out the distance from the start position to end position, then you can either:

1) set up a breaking point where speed will starting to decrease according to the scale of distance

e.g:

if(MC2 > breakPoint) //this is going to the right
speed = distance/scale;

or many other ways which I leave it to the others helpers :P

Regards
John

georgia
February 19th, 2003, 12:18 PM
thanks ilyaslamasse,

In the tutorial, the target for the movement is only itself. I'm having trouble tatgeting a second clip to move.

onClipEvent (mouseDown) {
(I need to set the _x of clip2)
_x = 0;
speed = 5;
}
onClipEvent (mouseDown) {
(I need clip2 to move to a specific _x value)
endX = _root._xmouse;
}
onClipEvent (enterFrame) {
(and decelerate)
_x += (endX-_x)/speed;
}

I hope I'm asking the question correctly, I'm a newbie
georgia
:-\

pom
February 19th, 2003, 06:52 PM
You don't need all the onMouseDown part (except if you want to lauch it on click). Just do something like this:
onClipEvent(EnterFrame){
_x += (_root.clip2._x-_x)/speed;
}pom :+)

lostinbeta
February 19th, 2003, 07:01 PM
Man oh man do I <B>HATE</B> crossposts.

http://www.kirupaforum.com/showthread.php?s=&threadid=15603

pom
February 19th, 2003, 07:18 PM
:scream: :skull:

georgia
February 19th, 2003, 10:06 PM
By cross posts do you mean puting a question in more than one place? I'm a newbie and I didn't know that was taboo, sorry for the mistake.

lostinbeta
February 19th, 2003, 10:11 PM
Yeah, when people post the same question in multiple sections it tends to get really confusing when answering them. I saw this thread and got all mixed up because I coulda SWORN I replied to it, but I didn't see any replies from me in here.

Then I found the other one and noticed it was posted twice.

But now you know :)