[F8] AS Easing Function

Hello!
Quick question for you guys. I’m working on this “game” and I currently have a ball that increases in speed as you hold down the arrow key. What I am now trying to accomplish is I want the ball to ease to a stop when the user let’s go of the keyboard key (onKeyUp). Here’s the File. <—Link

Here is my code so far:


var speed = 10;


ball_mc.onEnterFrame = function (){
    if(Key.isDown(Key.RIGHT)){
                this._x += speed += 1;  
    }
    if(Key.isDown(Key.UP)){
            this._y -= speed += 1;
    }
    if(Key.isDown(Key.LEFT)){
            this._x -= speed += 1;
            
    }
    if(Key.isDown(Key.DOWN)){
            this._y += speed += 1;  
    }
    if(speed >= 45){
        speed = 45;
    }
}

So once you let go of the Keyboard Key I want the ball to slow down to a stop. Thanks for your help!
-Loren :smirk: