After Effects Bounce Animation Expression (Free Project File)

After Effects Bounce Animation Expression (Free Project File)

Adding a bounce effect to your animations can make them feel more natural and polished. Instead of spending time keyframing the bounce manually, you can use a simple expression to automate it. It’s a quick and clean way to give motion elements like text, icons, or UI transitions a more dynamic feel.

Below you’ll find the full bounce expression, a step-by-step guide to using it in After Effects, and explanations of the parameters you can customize.

The Bounce Expression Code

Code
// Bounce Expression Code By KirtanFX.com

amp = 0.05;
freq = 2;
decay = 3;
time_max = 3;

n = 0;
if (numKeys > 0) {
  n = nearestKey(time).index;
  if (key(n).time > time) {
    n--;
  }
}

if (n == 0) {
  t = 0;
} else {
  t = time - key(n).time;
}

if (n > 0 && t < time_max) {
  v = velocityAtTime(key(n).time - thisComp.frameDuration);
  easeFactor = easeOut(t, 0, time_max, 1, 0);
  value + v * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t) * easeFactor;
} else {
  value;
}

This expression automatically creates a bounce effect after a keyframe, based on the motion velocity. The result feels smooth and dynamic, without the need for extra animation layers or keyframes.

How to Use This Expression in After Effects

  1. Add keyframes to the property you want to animate (e.g. Position, Scale).
  2. Hold Alt (or Option on Mac) and click the stopwatch icon next to that property.
  3. Paste the expression code into the expression field.
  4. Preview your animation. The bounce will trigger after the last keyframe.

This works best for position, scale, and rotation properties.

Explanation of Key Parameters

  • amp = 0.05
    Sets the strength of the bounce. Increase this value for a more dramatic bounce effect.
  • freq = 2
    Controls the speed of the bounce oscillation. Higher values result in faster, tighter bounces.
  • decay = 3
    Determines how quickly the bounce fades out. A higher value makes the bounce settle faster.

You can experiment with different combinations to create subtle or exaggerated bounce styles depending on the project.

Required Settings in After Effects

To make sure this expression runs correctly, you need to enable two important options in After Effects:

Navigate to:
Preferences > Scripting & Expressions

Make sure both of the following are checked:

  • Allow Scripts to Write Files and Access Network
  • Enable JavaScript Debugger

These settings are necessary for functions like velocityAtTime() to work properly.

Here’s what it should look like:

Stay tuned for more tutorials, free assets, and motion design tools here on KirtanFX.com. If you’re on Instagram, follow @kirtanfx for daily tips and effects breakdowns.

Thanks For Reading.

Newsletter Updates

Enter your email address below and subscribe to our newsletter