Inertia

amp = 0.05;

freq = 4.0;

decay = 7.0;

//ignore everything below this line

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

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

}else{

value;

}

 

Inertia is one of the most fun expressions out there!

So here is what it does:

If you have a layer with two linear keyframes on any property, for example; scale, position or rotation, then you will have animations that look similar to the example below.

Pretty boring right?!..

However, these two keyframes can be transformed into organic animations with the addition of the inertia expression. The expression uses maths to create a natural overshoot and bounce to the keyframes, as shown below.

The keyframes are identical in the above two examples. The only difference is the use of the expression at the top of this page.

Simply copy and paste the expression from above into any property with two keyframes. The closer the keyframes are together and therefore the faster the movement, the more overshoot and bounce you will have.

I understand it’s a long and confusing expression, but you really only need to worry about the top three lines; amp, freq & delay.

If you wanted to change the way the expression affects the animation, here is what each of these values does:

amp

amp is the amplitude of the expression. The higher this number the bigger the overshoot becomes. Small adjustments here are key, with a suggestion of never going much higher than 1.0. As you can see I have mine set to around 0.05 which I feel works nicely for most animations.

freq

freq is the frequency of the expression. This is the frequency in which the bounce occurs. The higher the number, the more bounces occur. For a natural feel I like to keep this number around 3-4, but feel free to play around to see what works for you.

decay

The decay is how quickly the overshoot and bounces wear off over time. The lower the number, the more elastic and bouncy the object will appear.

Again, the best way to learn what these three values do and how they affect the movement is to play around and see what changing their value does.

Have fun and enjoy!

Previous
Previous

Random

Next
Next

Delay