I came across an interesting post from Danny D, where he shares a couple small After Effects text animation expressions using inertial bounce and an example of them in use.

inertial bounce is a great expression to use, way back Harry Frank on Graymachine lists his 5 favorite expressions for After Effects, including Intertial Bounce, but also Autofade, Snap Zoom In/Out, Y Axis Jitter, and to Comp.

From Danny: **“The expressions below simply check the velocity of your animations in AE. If you move an objects motion ends abruptly (ie: you didn’t easeIn @ 100%) the physics will kick in automatically. It’s all just that stranger than fiction crap. The paragraph uses text animations (although it’s easy and i could have made it a plugin, it sucks because it’s harder to get words to just appear as opposed to fading in and out with the swings). Anyways, not for paragraphs and the proof is in the video. The code for the rest is below.”**

Kinetic Text Expressions for AE from Danny D on Vimeo.

**This is code for bouncy position movement. Just paste it in the position expression field, in this case it will affect x, y and z movements:**

// Inertial Bounce (moves settle into place after bouncing around a little)

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){

v = velocityAtTime(key(n).time – thisComp.frameDuration/10);

amp = .02;

freq = 3.0;

decay = 5.0;

value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{

value;

}

**And this is tweaked a bit for rotations… paste it in the x, y or z rotation. It will only affect the ones you place it in:**

// Inertial Bounce (moves settle into place after bouncing around a little)

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){

v = velocityAtTime(key(n).time – thisComp.frameDuration/10);

amp = 8;

freq = 2.0;

decay = 3.0;

value + (v/100)*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{

value;

}

## Matthew

I get an error when I apply the rotation equation..

It says

“Syntax error. Expression disabled.

Error occurred at line 6.

Comp: ‘DLNA’

Layer: 13 (‘Digital’)

Property: ‘X Rotation'”

I rotated a text layer on the x axis 90 degrees with no ease in/out.. I applied the the expression to the x axis, but got this error..

?

## Matthew

Wait, I see:

your minus signs are dashes..! I changed them to minus signs and it works!

## simone

both of them dont work in afx cs5…any clue why?

## Adrienne

I tried to apply the rotation expression above to the X Rotation of a 3D layer and get this error:

“Syntax error Expression disable. Error occurred at line 5.”

Any ideas?

## Adam

I get the same error message. Changing the dash to a minus symbol doesn’t change anything. Using CS4 64 bit.

## Adam

Found answers through the Vimeo comments. Replace the first instance (line 6) with 2 minus symbols, and the other 2 with just one minus symbol.

## kanadiou

Nice thanks,

but what about the animation of the paragraph with text animator ?

I don’t know how to do that…

## Harsha

THIS SHOULD WORK !

// Inertial Bounce (moves settle into place after bouncing around a little)

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){

v = velocityAtTime(key(n).time – thisComp.frameDuration/10);

amp = 8;

freq = 2.0;

decay = 3.0;

value + (v/100)*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{

value;

}

## Reejo Samuel

I fixed the errors, you can copy the code from pastebin here at http://pastebin.com/embed.php?i=42LtfFvQ

## Doug

This worked with CS5. Line six should have two minus signs.

Line 12 should have minus not dash

Line 15 should have minus not dash.

// Inertial Bounce (moves settle into place after bouncing around a little)

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){

v = velocityAtTime(key(n).time – thisComp.frameDuration/10);

amp = 8;

freq = 2.0;

decay = 3.0;

value + (v/100)*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{

value;

}

## JohnGaltUSA

Thanks for sharing this.

## Nicole Sylianteng

For the rotate code, AE says there is an error at line 6 (n-)

Any idea how to fix this?

## Lesterbanks

Replace the first instance (line 6) with 2 minus symbols

## Nicole Sylianteng

Thanks. I did that. But then it started gvig me other errors for lines whre there wa a minus It turns outthe code on thi page has some other kind of dash that AE wasn’t liking. I just replaced them all with a regular dash on the keyboard, and now it works great. s r the quick reply.

## scottnga

Code wouldn’t work for me either 🙁