# Mouse follow without easing

**URL:** <https://forum.kirupa.com/t/mouse-follow-without-easing/63975>\
**Category:** Uncategorized\
**Created:** [September 12, 2004, 3:18am UTC](https://forum.kirupa.com/t/mouse-follow-without-easing/63975 "2004-09-12T03:18:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maverick\_xj](https://avatars.discourse-cdn.com/v4/letter/m/6a8cbe/32.png) [@maverick\_xj](https://forum.kirupa.com/u/maverick_xj)\
**Post date:** [September 12, 2004, 3:18am UTC](https://forum.kirupa.com/t/mouse-follow-without-easing/63975/1 "2004-09-12T03:18:34Z")

</div>

hey guys

i just read the tutorial on mouse follow with easing  
i’ve been trying to work on it … not that its that hard …  
but what i’ve been trying to do is to make an object get to the mouse with any easing … at a constant rate  
probably i’m skipping on some concept, but i’m gettin into line equations n stuff … which is makin the code really comlpicated and still there are some hiccups in the code

can anyone come up with a code in which there is no easing ?

```auto
onClipEvent (load) {
 _x = 0;
 _y = 0;
 speed = 5;
}
onClipEvent (enterFrame) {
 endX = _root._xmouse;
 endY = _root._ymouse;
 _x += (endX-_x)/speed;
 _y += (endY-_y)/speed;
}

```

in this code , division with the constant “speed” is what results in the easing  
but i’m talkin about the object approaching the mouse at a constant rate

---

<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:** [September 12, 2004, 3:40am UTC](https://forum.kirupa.com/t/mouse-follow-without-easing/63975/2 "2004-09-12T03:40:05Z")

</div>

It’s simple if you know your math!

```auto
onClipEvent (load) {
 _x = 0;
 _y = 0;
}
onClipEvent (enterFrame) {
 endX = _root._xmouse;
 endY = _root._ymouse;
 _x += (endX-_x);
 _y += (endY-_y);
}

```

Really that’s all.

---

<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:** [September 12, 2004, 3:59am UTC](https://forum.kirupa.com/t/mouse-follow-without-easing/63975/3 "2004-09-12T03:59:48Z")

</div>

coppertop  
the thing u’re missing there is that is doesnt “go” to ur mouse , the object simply takes the same co-ordinates as ur mouse  
what i’m talkin about is making the object travel , with a speed factor that can be controlled , but the approach shud be at a constant rate
