Easing a movie clip into place using actionscript

Ok, I’ve only ever used tweening to move an object on the stage which always looks choppy. Say I have a movie clip that is just off the stage and I want to bring it to the center of the stage nice and smoothly starting slowly, getting faster and the slowing down, what actionscript would I have to use.

I really would appreciate the help as I am getting sick of the choppy look. I have searched for tutorials but found only ones that make objects follow a mouse smoothly.

In fact to make it easier, here’s a FLA which uses traditional tweening to move the object, what must I do with it to get rid of the tweening and replace it with a nice smooth actionscript?

Many thanks in advance

Well, the choppy look is caused by the low framerate. Increase the framerate to something among 35-40, and you will see that the effect has become a lot smoother.

Also, don’t forget to set the easing slider to Out to create an easing movement. If not, there will be no easing, but plain continuous movement.

Other than that, here’s a script you can use to ease a movieclip’s _x property using actionscript:


MovieClip.prototype.easeX = function(x){
this.onEnterFrame = function(){
this._x = x-(x-this._x)/1.2
if(this._x > x-1 && this._x < x+1){
delete this.onEnterFrame
}
}
}
//Usage:
yourMovieclip.easeX(250);

search for “easing”

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=44403&highlight=easing

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=46666&highlight=easing

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=46480&highlight=easing

to get you started

Voetsjoeba,
Thanks, great that!!!

aaah, Voets golden formula, very, very nice;)

You’re welcome, brinton :slight_smile:

I managed to do it for the y co-ordinates as well.