# MX6- Script trouble, movement easing

**URL:** <https://forum.kirupa.com/t/mx6-script-trouble-movement-easing/57485>\
**Category:** flash\
**Created:** [July 13, 2004, 6:27pm UTC](https://forum.kirupa.com/t/mx6-script-trouble-movement-easing/57485 "2004-07-13T18:27:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![codman3000](https://avatars.discourse-cdn.com/v4/letter/c/cdc98d/32.png) [@codman3000](https://forum.kirupa.com/u/codman3000)\
**Post date:** [July 13, 2004, 6:27pm UTC](https://forum.kirupa.com/t/mx6-script-trouble-movement-easing/57485/1 "2004-07-13T18:27:10Z")

</div>

Hi,  
I’m sure this is very simple, been searching the boards for ages, but can’t find the right solution. I want to create a simple actionscript rectangle mask which slides down to reveal an image when an swf is opened.

I would use a standard tween but the image is large and I want to have some nice easing going on.

This is what I have to move the rectangle:

onClipEvent (load) {  
this.\_y = 50;  
}  
onClipEvent (enterFrame) {  
if (this.\_y\<300) {  
this.\_y += 5;  
}  
}

I found this script for the easing, but I’m not sure where it goes in the above code:

k = elapsedTime/duration; // k = 0-1  
k = k_k_(3-2\*k); // apply easing  
\_x = start + (target - start)\*k;

I’m hoping its just a case of piecing these two bits of code together.  
Any help would be greatly appreciated, (Flash Mx6)

Cheers!

---

<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 13, 2004, 10:19pm UTC](https://forum.kirupa.com/t/mx6-script-trouble-movement-easing/57485/2 "2004-07-13T22:19:39Z")

</div>

try this:

onClipEvent (load) {  
speed = 3;  
this.\_y = 50;  
}  
onClipEvent (enterFrame) {  
if (this.\_y\<300) {  
this.\_y += (targetdesired- this.\_y)/speed;  
//replace targetdesired with where u want ur rectangle to be placed  
}  
}

i hope it helps 🙂

---

<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 14, 2004, 10:05am UTC](https://forum.kirupa.com/t/mx6-script-trouble-movement-easing/57485/3 "2004-07-14T10:05:49Z")

</div>

Thanks for your help g-shock I’ll give it a go.
