Adding Bounce Ball Effect with Expression in After Effects

Expressions are a great way to add some extra interest and realism to your animations. Using an expression to control the position of your layers can give you a lot of flexibility and control over your animation. In this tutorial, we’ll take a look at how to add bounce ball effect with expression.

First, let’s take a look at what the After Effects Bounce Ball Effect is and how it works. The effect uses an expression to control the position of your layers. This expression is based on the physics of a bouncing ball. When the ball hits the ground, it loses some energy and slows down. The amount of damping can be controlled by changing the parameters of the expression.

To do this, we’re not going to struggle with keyframes. We will use Expression. Thanks to expressions, we can easily apply such difficult animations to our project. We will make two different examples. One of these effects is to give the appearance of a ball dropped from the top down. You can paste the following code into the Position expression field and edit it according to yourself.

e = .5;
g = 20000;
nMax = 9;

n = 0;
if (numKeys > 0){
  n = nearestKey(time).index;
  if (key(n).time > time) n--;
if (n > 0){
  t = time - key(n).time;
  v = -velocityAtTime(key(n).time - .001)*e;
  vl = length(v);
  if (value instanceof Array){
    vu = (vl > 0) ? normalize(v) : [0,0,0];
    vu = (v < 0) ? -1 : 1;
  tCur = 0;
  segDur = 2*vl/g;
  tNext = segDur;
  nb = 1; // number of bounces
  while (tNext < t && nb <= nMax){
    vl *= e;
    segDur *= e;
    tCur = tNext;
    tNext += segDur;
  if(nb <= nMax){
    delta = t - tCur;
    value +  vu*delta*(vl - g*delta/2);

We use this After Effects preset code for an object that you give a scale effect. We use this code to give the object an elastic look.

amp = .1;
freq = 2.0;
decay = 2.0;

n = 0;
time_max = 4;
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 && t < time_max){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

Expression logic is very important. As you can see, by adding a few lines of code, we can make these animations much more realistically than we would do manually by keyframing. If we try to do them without expression, we will both waste time and the result will not be so realistic. Through these expressions, we can make bouncing effects or stretching effects very easily.

Popular Tutorials

Create Security Camera / CCTV Effect in After Effects

We don’t really need a security camera to get security footage. In…

How to Create Youtube Channel Intro Animation with After Effects?

Adobe After Effects is a powerful video editing tool that lets you…

Audio Spectrum in After Effects | Sound Wave Effect Without Music

I show you have to make a simple sound wave with After…

Export Settings We Need to Know for Transparent Texts

In this video, I will show you how we can export the…

Hand Drawn Look Effect in After Effects

In this video, I will show you how to make pencil drawings…

Creating Perfect Audio Spectrum Effect in After Effects

I’m going to show you a new alternative method with audio spectrum…