# Easing while moving something in relation to mouse?

**URL:** <https://forum.kirupa.com/t/easing-while-moving-something-in-relation-to-mouse/229519>\
**Category:** flash\
**Created:** [June 18, 2007, 6:53am UTC](https://forum.kirupa.com/t/easing-while-moving-something-in-relation-to-mouse/229519 "2007-06-18T06:53:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vexir](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@Vexir](https://forum.kirupa.com/u/Vexir)\
**Post date:** [June 18, 2007, 6:53am UTC](https://forum.kirupa.com/t/easing-while-moving-something-in-relation-to-mouse/229519/1 "2007-06-18T06:53:59Z")

</div>

Hey guys. I have a stack of images that I need to move down when the mouse is above y = 250 and up when the mouse is below y = 250. I have this code, but the problem is I don’t know how to add easing. Can anyone pose a solution? Thanks :beam:

```auto
onEnterFrame = function() {
	someConstant = 2342;
	lastIndex = picThumbArray.length - 1;
	lastImage = imageStack_mc["picContainer"+lastIndex];
	firstImage = imageStack_mc.picContainer0;
	if (_xmouse > 750 && _xmouse < 950) {
		if (_ymouse < 250) {
			if (imageStack_mc._y < 45) {
				imageStack_mc._y += 2;
				//imageStack_mc._y = (45 - imageStack_mc._y) / someConstant;
			}
		} else {
			if (imageStack_mc._y > (540 - (83 * picThumbArray.length + 75))) {
				imageStack_mc._y -= 2;
			}
		}
	}
}

```

p.s. that one line thats commented out, this one: //imageStack\_mc.\_y = (45 - imageStack\_mc.\_y) / someConstant; is my attempt at easing , but that code just makes it zoom instantly to 45. wierd.
