# Easing

**URL:** <https://forum.kirupa.com/t/easing/23875>\
**Category:** Uncategorized\
**Created:** [June 23, 2003, 6:40pm UTC](https://forum.kirupa.com/t/easing/23875 "2003-06-23T18:40:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pweb](https://avatars.discourse-cdn.com/v4/letter/p/838e76/32.png) [@pweb](https://forum.kirupa.com/u/pweb)\
**Post date:** [June 23, 2003, 6:40pm UTC](https://forum.kirupa.com/t/easing/23875/1 "2003-06-23T18:40:05Z")

</div>

I couldn’t find anything in search so here it goes.

I am trying to use LBA’s tutorial on mouse follow with easing to achieve a similar effect like on [http://www.mediaengine.com](http://www.mediaengine.com). Could anyone help me break this down as i’m pretty new to Action Scripting.

Thanks in advance

Joe R.

---

<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:** [June 23, 2003, 7:27pm UTC](https://forum.kirupa.com/t/easing/23875/2 "2003-06-23T19:27:16Z")

</div>

wrong section, you probally wont get any answers on this section, not to many people come here. I will contact a mod to move it to the correct place for you.🙂

---

<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:** [June 23, 2003, 8:54pm UTC](https://forum.kirupa.com/t/easing/23875/3 "2003-06-23T20:54:31Z")

</div>

thanx alex.

---

<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:** [June 24, 2003, 12:03am UTC](https://forum.kirupa.com/t/easing/23875/4 "2003-06-24T00:03:35Z")

</div>

what are you talking about alex? i always go here :).

here’s your basic mousefollow with easing:

```auto
onClipEvent (enterFrame) {
_x += (_root._xmouse-_x)/7;
_y += (_root._ymouse-_y)/7;
}

```

create a movieclip symbol and insert this code in it and see what happens (Ctrl+Enter…). Ok this code basically causes the object to follow the mouse with some easing. How does this work? Well, when you add the distance between the mouse and the object to its position (eg, \_x += \_root.\_xmouse-\_x;), then the object will instantly go to the mouse. to _delay_ its travel, or ease, we divide that distance so that it will eventually end up where the mouse is, but it will take longer, depending on what value you use to ease it in (7 in this case). a higher number will take it longer to get there, whereas a lower number will move it sooner.

you don’t always have to ease to the mouse, you can do it with any other object; the basic format is:

_position_ += (_point 2_ + _current position_) / _easing_

(btw, “+=” is the same thing as saying \_x = \_x+_whatever_, or \_x += _whatever_)

i hope this helps. contact me if you still need help with easing.

---

<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:** [June 24, 2003, 12:15am UTC](https://forum.kirupa.com/t/easing/23875/5 "2003-06-24T00:15:01Z")

</div>

thoriphes: This was posted in the “book Help section”. So i contacted Kit, and she moved it to the correct place. 🙂

---

<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:** [June 24, 2003, 12:16am UTC](https://forum.kirupa.com/t/easing/23875/6 "2003-06-24T00:16:20Z")

</div>

oh, lol. odd location indeed. 😛

---

<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:** [June 24, 2003, 2:47pm UTC](https://forum.kirupa.com/t/easing/23875/7 "2003-06-24T14:47:26Z")

</div>

on this subject  
using **flash5**  
how about easing a curved motion…

i have tried a number of things  
in a movie i have where you enter the final coordinates

and have had no luck with both positions being met moving the object in a curve

you can see here, it works in a straight line fine ± a pixel  
due to rounding

[http://www.route108.com/soup/portfolio/controlled\_motion\_5.swf](http://www.route108.com/soup/portfolio/controlled_motion_5.swf)

```auto

onClipEvent(enterFrame) {	
	count=0;
        while (count<_root.numbDupe) {
			this.duplicateMovieClip("ball1"+count, count);
			_root.ball10._x = _root.ball1._x;
			_root.ball10._y = _root.ball1._y;
			_root.ball10._alpha = 98;
			_root["ball1"+count]._x = _root["ball1"+(count-1)]._x-(_root.tarX-_root.ball1._x)/10;
			_root["ball1"+count]._y = _root["ball1"+(count-1)]._y-(_root.tarY-_root.ball1._y)/10;
			_root["ball1"+count]._alpha = _root["ball1"+(count-1)]._alpha-2;
			count += 1;
		}
        if ( _root.curX != _root.tarX && _root.curY != _root.tarY) {
                this._x += (_root.tarX - _root.curX)/10;
                this._y += (_root.tarY - _root.curY)/10;
                this._xscale =_root.curScaleX;
                this._yscale =_root.curScaleY;
		

			_root.curX = Math.round(this._x);
			_root.curY = Math.round(this._y);
			trace(_root.curX+"__"+_root.curY);

        }
		else if( _root.curX == _root.tarX or _root.curY == _root.tarY ) {

			for(i=0; i< _root.numbDupe; ++i) {
			removeMovieClip(_root["ball1"+i]);
			}

            startMove = false;

       	}

}

```

a bit long winded, but…

soup

---

<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:** [June 24, 2003, 4:40pm UTC](https://forum.kirupa.com/t/easing/23875/8 "2003-06-24T16:40:59Z")

</div>

Thanks for the help… For some reason I can’t get it to work. I get an error saying this action is reserved for movie instances. Which it is applied to. I probably have the layout all messed up. here is the address to my fla file. [http://joe.it.pacificwebworks.com/JD/Various/testclouds2.fla](http://joe.it.pacificwebworks.com/JD/Various/testclouds2.fla) Maybe you guys can see what I have done wrong. This file just has a basic mouse follow without easing. Feel free to delete it.

Thanks again for helping me, i’m a noob at this.

OH and i posted it there on mistake after reading its discription saying Post any questions or problems you may be having with any of the examples, tutorials, and more! I didn’t look at the title. So thanks again alex for getting this moved.
