The bounce expression is convenient for adding a bouncing motion to layer parameters. The roots of this expression derive from Dan Ebberts. I like to apply this expression to add realistic inertial movement.

I use sliders to control the amplitude, frequency and decay variables in the expression. Amplitude is the amount of bounce. Frequency is how frequently the bounce happens. Decay is like friction. The more you apply, the less the bounce lasts.

Alt-click (Windows) or Option-click (Mac) the stopwatch next to a layer property, such as position or scale, to add an expression. Type in your values for the variables, linking them to the slider. I rename my sliders so they’re easy to decipher.

amp = effect(“Amplitude”)(“Slider”);
freq = effect(“Frequency”)(“Slider”);
decay = effect(“Decay”)(“Slider”);

Then, add the bounce expression:

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
if (n == 0){
t = 0;
t = time – key(n).time;
if (n > 0){
v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

Now, you can add keyframes to your property and the bounce expression will add the inertial motion to your movements based on the value of your sliders. This expression can be added to multiple properties for a combined effect.

My quick tutorial video shows this expression applied to the position, rotation and scale properties.