top of page

Bounce Expression

Background Line UI

Time Based Animation, Bounce Expression, Dynamic, Advanced Expressions

Bounce Expression

This expression creates a bounce effect based on the velocity at the keyframe, with configurable amplitude, frequency, and decay values.

Imagine animating a ball falling to the ground, and you want it to bounce. Apply the bounce expression to the Position property of the ball layer. By adjusting the Amplitude (height of the bounce), Frequency (speed of the bounce), and Decay (how quickly the bounce fades), you can create a realistic bounce effect.

amp = 0.1; // Amplitude (Bounce height)
freq = 2.0; // Frequency (Bounce speed)
decay = 5.0; // Decay (Bounce fading speed)
n = 0; // Keyframe index
time_max = 4; // Maximum duration for bounce (after keyframe)

if (numKeys > 0) { // If there are keyframes
n = nearestKey(time).index; // Get nearest keyframe index
if (key(n).time > time) { // If the nearest keyframe is in the future
n--; // Go to the previous keyframe
}
}

if (n == 0) {
t = 0; // No bounce before the first keyframe
} else {
t = time - key(n).time; // Time since the last keyframe
}

if (n > 0 && t < time_max) { // If there's a keyframe and the bounce is within time limit
v = velocityAtTime(key(n).time - thisComp.frameDuration/10); // Get the velocity at keyframe
value + v * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t); // Apply the bounce
} else {
value; // No bounce after the time limit
}

How to Use This Expression?

  • Select a Property: Choose a property to apply the bounce effect (e.g., Position, Scale, or Rotation).

  • Apply the Expression: Alt + Click (Windows) or Option + Click (Mac) the stopwatch icon for the selected property.
    Paste the expression into the editor.

  • Animate the Property: Add keyframes to the property. The bounce will automatically be applied at each keyframe.

Customize the Parameters:


Adjust amp, freq, decay, and time_max to modify the bounce behavior: Higher amp increases bounce height.
Higher freq speeds up the bounce oscillation.
Higher decay makes the bounce fade faster.
Higher time_max prolongs the bounce duration.

Support Our Mission to Keep It Free

Your contribution ensures ongoing access to high-quality, easy-to-use After Effects expressions and libraries for

everyone.

Trending
Free After Effects Tutorials & Templates

As one of YouTube's leading creators of Motion Graphic Tutorials, we provide a diverse array of resources, including After Effects templates, royalty-free sound effects, and Photoshop PSD Templates. We also offer premium After Effects Templates and Sound Effects, designed to meet the needs of both beginners and professionals in the Motion Graphics field.

Copyright © 2025 Avnish Parker.

All Rights Reserved.

Follow Us

  • Youtube
  • Grey Facebook Icon
  • Twitter
  • Instagram
  • Patreon_logo_Small_edited_edited
Online Payment Icons
bottom of page