 # Smooth Movie Clip Rotation

is there any way to get a smooth rotation in AS? I would assume i would use this._rotation, but it doesn’t smoothly rotate the way i want it to…
I’m trying to make a movie clip that randomly goes to a location while rotating. here’s what code i have now.

{
speed = .2;
xLocation = 0;
yLocation = 0;
}
onClipEvent (enterFrame)
{
if (Math.ceil(this._x) == xLocation && Math.ceil(this._y) == yLocation)
{
xLocation = random(390);
yLocation = random(190);

``````}
this._x = (this._x + (xLocation - this._x) * speed);
this._y = (this._y + (yLocation - this._y) * speed);
``````

}

Any Ideas?

Ok, i’ve put in a clip of code where it continuously rotates, but how do i get it so it slows rotation when it gets closer to the point it’s going to?
i used this._rotation += random(20);

I guess i might as well turn this into a tutorial, or someone else can, cause i figured out how to do this now.
This is the line of code to make it rotate, i put some extras in there to make it seem like it’s rolling…

this._rotation = (yLocation - this._y) - (xLocation - this._x);

So there we go, i’ve solved my own problem.

Sorry no one replied to you in time. Glad you got it working though. Good job sir.

hehe yeah good work…i was working on a menu thing once and it sorta stuffed up after clicking the button 3 or 4 times…
Rotate Thing

i havn’t looked it in a while…but yeah i dont know what the problem is…
i think that if i had a look it might work agian hehe Guess i might as well post this so that y’all can see what it looks like…only 1k. Sorry about it being geocities, just had to set something up real quick.

http://www.geocities.com/randommovement2002

By the way, here’s the code:

{
speed = .1;
xLocation = 0;
yLocation = 0;
}
onClipEvent (enterFrame)
{
if (Math.ceil(this._x) == xLocation && Math.ceil(this._y) == yLocation)
{
xLocation = random(390);
yLocation = random(190);

``````}
this._x = (this._x + (xLocation - this._x) * speed);
this._y = (this._y + (yLocation - this._y) * speed);
this._rotation = ((yLocation - this._x) + (xLocation - this._y)/2);
``````

}