# Bouncing ball with slow motion button

**URL:** <https://forum.kirupa.com/t/bouncing-ball-with-slow-motion-button/309627>\
**Category:** Uncategorized\
**Created:** [May 20, 2010, 3:01am UTC](https://forum.kirupa.com/t/bouncing-ball-with-slow-motion-button/309627 "2010-05-20T03:01:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![genericguy](https://avatars.discourse-cdn.com/v4/letter/g/5daacb/32.png) [@genericguy](https://forum.kirupa.com/u/genericguy)\
**Post date:** [May 20, 2010, 3:01am UTC](https://forum.kirupa.com/t/bouncing-ball-with-slow-motion-button/309627/1 "2010-05-20T03:01:09Z")

</div>

Hello and thanks in advance for your help.

I have a ball bouncing that works great. What I want is a button that will make the ball look like its in slow motion and another button to put it back in regular motion. After hours of experimenting I still couldn’t get it perfect. The following code is on the ball movieclip.

```auto

onClipEvent (load) {
    var acceleration = 0.005;
    var termVelocity = 20;
    var yVel = 0;
    var e = 1.3;
}
onClipEvent (enterFrame) {
    yVel += (termVelocity-yVel)*acceleration;
    this._y += yVel;
    if (_root.ground.hitTest(this)) {
        yVel *= -1*e;
    }
}

```
