# Bounce and Squash

**URL:** https://forum.kirupa.com/t/bounce-and-squash/195962
**Category:** flash
**Created:** [August 4, 2006, 7:54am UTC](https://forum.kirupa.com/t/bounce-and-squash/195962 "2006-08-04T07:54:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![davidb2002](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/davidb2002/32/1512_2.png) [@davidb2002](https://forum.kirupa.com/u/davidb2002)
#### Post date: [August 4, 2006, 7:54am UTC](https://forum.kirupa.com/t/bounce-and-squash/195962/1 "2006-08-04T07:54:44Z")

</div>

Okay, so I have a movieclip of a letter (done in photshop to look like jelly). I want to animate it to fall from above, bounce on an invisiable plane, squash when it hits, and squash and go back up and decrease it each time until it comes a rest.

I have the bounce but I need to squash.

Code

```auto

onClipEvent(load){
    var vel:Object = { x: 0, y: 0 };
    var pos:Object = { x: _x, y: _y};
    var old:Object = { x: _x, y: _y};
    var radius:Number = this._width / 2;
    var movie:Object = {width: 750, height: 117};
    var dragging: Boolean = false;
}
onClipEvent(enterFrame) {
    vel.y += _root.gravity;
    
    pos.x += vel.x;
    pos.y += vel.y;
    
    // Now update the ACTUAL postion of the movie clip
    _x = post.x;
    _y = pos.y;
    // Has the ball left the bottom of the stage?... 
if( pos.y + radius > movie.height ) { 
  pos.y = movie.height - radius; 
  vel.y *= -_root.restitution; 
} 
}

```
