# Bounce Expression

How To Use After Effects Bounce Expression with Expression Base

## Introduction: What is Bounce Expression in After Effects?

In this article, we're going to take a look at Bounce Expressions in Adobe After Effects. More specifically, we'll discuss what they are, how to create them, and some of the ways you can use them in your compositions with the help of Expression Base. First things first, let's start with a quick definition:

A bounce expression is an animation curve that is used to create a bouncing motion. (Adobe After Effects CC 2017 Classroom in a Book)

## What Do Elasticity and Gravity mean in Bounce Expression?

Elasticity is the ability of an object to return to its original shape after being stretched or compressed.

Gravity is the force that attracts objects toward the center of the Earth.

In the context of bounce expressions, elasticity is how bouncy the layer is, and gravity is how heavy the layer is. The higher the elasticity and gravity values, the more bouncy and heavy the layer will be, respectively.

## How to Apply Bounce Expression on Layer Properties in After Effects

Here is the code that will be used to create a bounce expression with the help of Expression Base:

``````//~~~~~~~PUBLIC EXPRESSION GENERATED BY EXPRESSION BASE~~~~~~~ //
e = elasticity@s;
g = gravity@s;
nMax = nbBounces@s;

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];
}else{
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;
nb++
}
if(nb <= nMax){
delta = t - tCur;
value +  vu*delta*(vl - g*delta/2);
}else{
value
}
}else
value
``````

The `Elasticity`, `Gravity` and `nbBounces` parameters are all controlled by the sliders generated by Expression Base the Smart Expression Controls.

Here is an example of how to use the wiggle expression with the help of Expression Base:

1. Click on the layer property you want to apply the wiggle expression to.
2. Click on the Expression Base Search icon in the top left corner or use your own short key.
3. Select the wiggle expression from the search results.
4. Click on Single layer control in Expression Base. 5. Adjust the `Frequency` and `Amplitude` sliders to your liking as shown in the image below. ## Wiggle Expression in Action - 8 Uses Cases for Creative Animations with Expressions!

In this section, we will show you how to use the wiggle expression to create more organic movement in your animations.

### Wiggle on the X axis

This expression will apply a wiggle animation on the X axis of any given 2-dimensional property i.e (X,Y).

Note: `Value` is the current Y axis value of the layer's property.

``````// Frequency = 5, Amplitude = 20
[wiggle(Frequency@s,Amplitude@s),value]
`````` ### Wiggle on the Y axis

This expression will apply a wiggle animation on the Y axis of any given 2-dimensional property i.e (X,Y).

Note: `value` is the current X axis value of the layer's property.

``````// Frequency = 5, Amplitude = 20
[value,wiggle(Frequency@s,Amplitude@s)]
`````` ### Wiggle on the Z axis

This expression can only be applied to a 3D layer with a Z axis.

Note: `value` and `value` are the current X and Y axis values of the layer's property.

``````// Frequency = 5, Amplitude = 20
[value,value,wiggle(Frequency@s,Amplitude@s)]
`````` ### Wiggle on the rotation property

``````// Frequency = 5, Amplitude = 50
wiggle(Frequency@s,Amplitude@s)
`````` ### Wiggle on the scale property

``````// Frequency = 5, Amplitude = 20
wiggle(Frequency@s,Amplitude@s)
`````` ### Wiggle on the position property

``````// Frequency = 5, Amplitude = 20
wiggle(Frequency@s,Amplitude@s)
`````` ### Wiggle on the opacity property

``````// Frequency = 5, Amplitude = 50
wiggle(Frequency@s,Amplitude@s)
`````` ### Wiggle on the color property

``````// Frequency = 5, Amplitude = 0.5
wiggle(Frequency@s,Amplitude@s)
`````` ## Conclusion

This article explains what wiggle expression is in after effects and how you can use it to speed up your workflow. The wiggle expression is a great way to add movement to your animations, and Expression Base makes it easy to use. Download Expression Base today to start using the wiggle expression in your own animations.

Keywords: after effects expression bounce,expression base extension, bounce expression after effects, after effects wiggles, ae bounce, expression controls, after effects expression