# Easing in and out of scroll

**URL:** <https://forum.kirupa.com/t/easing-in-and-out-of-scroll/9068>\
**Category:** flash\
**Created:** [December 4, 2002, 2:45am UTC](https://forum.kirupa.com/t/easing-in-and-out-of-scroll/9068 "2002-12-04T02:45:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tripwire](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@tripwire](https://forum.kirupa.com/u/tripwire)\
**Post date:** [December 4, 2002, 2:45am UTC](https://forum.kirupa.com/t/easing-in-and-out-of-scroll/9068/1 "2002-12-04T02:45:34Z")

</div>

I’ve created a page that contains 3 different movie clips that scroll left and right in respose to the mouse. They each move at different rates and create a parallax effect. My question is how do I ease the movie clips in and out of their stop positions? At the moment they all run full speed in and out of a stop.

Here is what I have so far:

In frame one:

center = 320;  
reelPos = reel.\_x;  
leftStop = -100;  
rightStop = 45;

objPos = objects.\_x;  
objleftStop = -600;  
objrightStop = 110;

In frame two:

// posts controller  
reelSpeed = (\_xmouse-center)/70;  
reelPos = Math.round (reelPos-reelSpeed);  
if (reelPos reelPos = leftStop;  
}  
if (reelPos\>rightStop) {  
reelPos = rightStop;  
}  
reel.\_x = reelPos;

// objects controller  
objSpeed = (\_xmouse-center)/15;  
objPos = Math.round (objPos-objSpeed);  
if (objPos objPos = objleftStop;  
}  
if (objPos\>objrightStop) {  
objPos = objrightStop;  
}  
objects.\_x = objPos;

This is then looped to create the movement. Can anyone offer some suggestions?

---

<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:** [December 4, 2002, 3:50am UTC](https://forum.kirupa.com/t/easing-in-and-out-of-scroll/9068/2 "2002-12-04T03:50:38Z")

</div>

Wow your if statements above are messed up.

Try putting your code between [PHP] [/PHP] tags (without spaces) for it to work without converting anything to html accidentally or something, because right now it doesn’t work even when I do fix it so I need the original code.

---

<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:** [December 4, 2002, 5:08am UTC](https://forum.kirupa.com/t/easing-in-and-out-of-scroll/9068/3 "2002-12-04T05:08:21Z")

</div>

Sorry, lets try this again. Frame two should read like this:

```php

// posts controller
reelSpeed = (_xmouse-center)/70;
reelPos = Math.round (reelPos-reelSpeed);
if (reelPos<leftStop) {
  reelPos = leftStop;
}
if (reelPos>rightStop) {
  reelPos = rightStop;
}
reel._x = reelPos;
  
// objects controller
objSpeed = (_xmouse-center)/15;
objPos = Math.round (objPos-objSpeed);
if (objPos<objleftStop) {
  objPos = objleftStop;
}
if (objPos>objrightStop) {
  objPos = objrightStop;
}
objects._x = objPos;

```

I tried creating an empty movie clip adding the event handler, onClipEvent(enterFrame) to help control the movments, but that wasn’t working properly and I don’t know if thats the best approach anyway.

---

<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:** [December 4, 2002, 6:01am UTC](https://forum.kirupa.com/t/easing-in-and-out-of-scroll/9068/4 "2002-12-04T06:01:12Z")

</div>

I can’t seem to get it if there is ☹

Sorry.
