# Motion Easing with AS

**URL:** <https://forum.kirupa.com/t/motion-easing-with-as/98991>\
**Category:** Uncategorized\
**Created:** [January 13, 2004, 4:24pm UTC](https://forum.kirupa.com/t/motion-easing-with-as/98991 "2004-01-13T16:24:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Monabizi](https://avatars.discourse-cdn.com/v4/letter/m/4491bb/32.png) [@Monabizi](https://forum.kirupa.com/u/Monabizi)\
**Post date:** [January 13, 2004, 4:24pm UTC](https://forum.kirupa.com/t/motion-easing-with-as/98991/1 "2004-01-13T16:24:49Z")

</div>

Hi,  
how do i can i adjust the Easing property of moving MC when im moving the MC with AS (not with motion tween) ?!

i got an MC and im increasing it’s \_x by 1 till the \_x got to 100.  
how can i adjust the easing, so that when it become close to 100 it will slowly stopped?

anyone?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2004, 3:28am UTC](https://forum.kirupa.com/t/motion-easing-with-as/98991/2 "2004-04-08T03:28:47Z")

</div>

I´m using Voetsjoeba´s code for easing, but can I apply robert penner´s code´s to it?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 8:22am UTC](https://forum.kirupa.com/t/motion-easing-with-as/98991/3 "2004-07-07T08:22:54Z")

</div>

Good sample Industriality Thank you! but someone can tell me how to move an object not on x or y but on [FONT=Arial Black][COLOR=Red]diagonal[/COLOR][/FONT]?

_Lobo_

> [@Industriality](#):
>
> If anyone is interested, I expanded a bit on Voetsjoeba’s code in order to add a “round” attribute, and a “speed” attribute. This is very useful when you need to ease a movieclip that uses Pixel fonts, or fonts that look best on whole pixels. Here are the two functions:
> 
> ```auto
> 
> MovieClip.prototype.easeX = function(to,speed,round){
> this.onEnterFrame = function(){
> if(round!=true){
> this._x += (to - this._x)/speed;
> } else {
> this._x += Math.round((to - this._x)/speed);
> }
> if(this._x > to-1 && this._x < to+1){
> this._x = to;
> delete this.onEnterFrame
> //do other stuff here, this is the point at which the object reaches its target
> }
> }
> }
> MovieClip.prototype.easeY = function(to,speed,round){
> this.onEnterFrame = function(){
> if(round!=true){
> this._y += (to - this._y)/speed;
> } else {
> this._y += Math.round((to - this._y)/speed);
> }
> if(this._y > to-1 && this._y < to+1){
> this._y = to;
> delete this.onEnterFrame
> //do other stuff here, this is the point at which the object reaches its target
> }
> }
> }
>  
> 
> ```
> 
> **Usage Examples:**  
> [size=1]mc.easeX(mc.\_x-100,5,true); // Move mc 100 pixels left, on solid pixels, at “5” speed[/size]  
> [size=1]mc.easeX(mc.\_x+100,10,false); // Move mc 100 pixels right, smoothly, at “10” speed[/size]  
> [size=1]mc.easeY(mc.\_y-100,5,true); // Move mc 100 pixels up, on solid pixels, at “5” speed[/size]  
> [size=1]mc.easeY(mc.\_y+100,10,false); // Move mc 100 pixels down, smoothly, at “10” speed[/size]  
> [size=1]mc.easeX(100,5,true); // Move mc to an X of 100, on solid pixels, at “5” speed[/size]  
> [size=1]mc.easeY(100,5,true); // Move mc to a Y of 100, on solid pixels, at “5” speed[/size]  
> [size=1]mc.easeX(100,10,false); // Move mc to an X of 100, smoothly, at “10” speed[/size]  
> [size=1]mc.easeY(100,10,false); // Move mc to a Y of 100, smoothly, at “10” speed[/size]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 7:53am UTC](https://forum.kirupa.com/t/motion-easing-with-as/98991/4 "2004-07-21T07:53:47Z")

</div>

Thank you I will try that ! 🍺

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 21, 2004, 8:20am UTC](https://forum.kirupa.com/t/motion-easing-with-as/98991/5 "2004-07-21T08:20:25Z")

</div>

var easeInKnob =  
var easeOutKnob =  
Was it wrong for me to laugh like a 10-year old schoolboy when I read this?

Maybe it’s just my British sense of humour.
