# Easing mask?

**URL:** <https://forum.kirupa.com/t/easing-mask/63566>\
**Category:** Uncategorized\
**Created:** [September 8, 2004, 1:02am UTC](https://forum.kirupa.com/t/easing-mask/63566 "2004-09-08T01:02:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![azithinkibe](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@azithinkibe](https://forum.kirupa.com/u/azithinkibe)\
**Post date:** [September 8, 2004, 1:02am UTC](https://forum.kirupa.com/t/easing-mask/63566/1 "2004-09-08T01:02:47Z")

</div>

How would I go about making an easing mask? One that sticks to a horizontal axis and follows the mouse pointer (already got that doen) but also eases before it stops, like a motion ease; slowly slowing down instead of quickly whipping to where the user moves the mouse.

---

<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 8, 2004, 1:42am UTC](https://forum.kirupa.com/t/easing-mask/63566/2 "2004-09-08T01:42:35Z")

</div>

what AS are you using for your easing so far?

---

<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 8, 2004, 3:15pm UTC](https://forum.kirupa.com/t/easing-mask/63566/3 "2004-09-08T15:15:19Z")

</div>

Try this tutorial…

[http://www.flashkit.com/tutorials/Actionscripting/Expert/Creating-Morten\_B-540/index.php](http://www.flashkit.com/tutorials/Actionscripting/Expert/Creating-Morten_B-540/index.php)

or

[http://www.flashkit.com/tutorials/Special\_Effects/Physics\_-Rudestar-936/index.php](http://www.flashkit.com/tutorials/Special_Effects/Physics_-Rudestar-936/index.php)

One of those should help ya.

---

<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 8, 2004, 8:05pm UTC](https://forum.kirupa.com/t/easing-mask/63566/4 "2004-09-08T20:05:25Z")

</div>

Okay, I’ll check those out when I get home…

This is the script im using on the mask so far by the way…

onClipEvent(enterFrame){  
getlimits=\_root.boundary.getBounds(\_root);  
if(\_root.\_xmouse\>=getlimits.xMin && \_root.\_xmouse\<=getlimits.xMax &&  
\_root.\_ymouse\>=getlimits.yMin && \_root.\_ymouse\<=getlimits.yMax){  
this.\_x=\_root.\_xmouse;

```
 }

```

}

---

<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 8, 2004, 8:24pm UTC](https://forum.kirupa.com/t/easing-mask/63566/5 "2004-09-08T20:24:46Z")

</div>

So I checked out one of those tutorials, and found this code…

myTrailer\_mc.onEnterFrame = function (){  
with(this){  
distX = (\_root.\_xmouse - \_x);  
distY = (\_root.\_ymouse - \_y);  
\_x += distX_0.2;  
\_y += distY_0.2;  
}  
}

It works fine on an object, like a circle, or even my particular mask. But it seems to only work verticaly. For instance, if I move the mouse up and down, you can easily see that the mask is easing behind it. But from left to right, it appears to instantly snap to the mouse instead of easing.

Whats up with 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:** [September 8, 2004, 8:29pm UTC](https://forum.kirupa.com/t/easing-mask/63566/6 "2004-09-08T20:29:20Z")

</div>

Okay, solved more of the problem. 🙂

I think it was cause i was putting the script on the object instead of the first frame.

Anyway, now i have this…

camera.onEnterFrame = function (){  
getlimits=\_root.boundary.getBounds(\_root);  
if(\_root.\_xmouse\>=getlimits.xMin && \_root.\_xmouse\<=getlimits.xMax &&  
\_root.\_ymouse\>=getlimits.yMin && \_root.\_ymouse\<=getlimits.yMax){  
camera.\_x=\_root.\_xmouse;

camera.onEnterFrame = function (){  
with(this){  
distX = (\_root.\_xmouse - \_x);  
distY = (\_root.\_ymouse - \_y);  
\_x += distX\*.2;  
\_y += distY\*.2;  
}  
}

```
}

```

}

Now the mask eases wherever I move it, but it comes off the horizontal axis now. It’s supposed to only be able to slide left and right along a row of pictures.

But the script that is supposed to stick it to the axis (the first half) doesnt work now that I’ve added in the easing script…
