AFTER EFFECTS EXPRESSIONS

They can be quite daunting but you can do some pretty powerful things in After Effects using expressions. I can't claim any ownership of the below – but here's some of the most useful ones I tend to use in pretty much every motion graphics project I do.

INERTIAL BOUNCE

This particular version has been developed by Harry Frank and is an expression I use in almost every mograph project I do. Essentially, Inertial Bounce creates a bouncing motion of any parameter from one keyframe to the next, based on it's velocity. Modify “amp” for how much bounce there is (I tend to leave this as is!). The “freq” variable is the frequency, or how frequently the bounce occurs. The “decay” is like friction, a higher value means the bounce comes to a stop quicker.

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

n--;

}}

if (n == 0){ t = 0;

}else{

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

}else{value}

WIGGLE

Apply to any parameter to add a constant randomness. It can be controlled by changing the numerals in the brackets. The first one determines the speed (frequency) of the wiggle, and the second will alter the amount (or amplitude). I often pick whip one of these value to a slider control in order to animate the wiggle as and when required!

wiggle(0,0);

LOOP

Loop expressions do exactly what you would expect really. However, there are various types of the loop expression which produce different results — not necessarily just an infinite loop after your keyframes. These expressions can be used to help a lot when working on walk cycles, HUD elements, repeating background designs, and much more!

- loopOut(“cycle”)
- loopOut(“pingpong”)
- loopOut(“offset”)

Check out this post by School of Motion to get a much more in-depth breakdown of the different types of loop expressions and how they work.

LOOP WIGGLE

Thank the great Dan Ebberts for this one. Apply as you would a regular Wiggle expression but set the loopTime to the length of the loop you require in seconds.

freq = 1;

amp = 110;

loopTime = 3;

t = time % loopTime;

wiggle1 = wiggle(freq, amp, 1, 0.5, t);

wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime);

linear(t, 0, loopTime, wiggle1, wiggle2)

DELAY INHERITED PARENT POSTION

This one is pretty cool! Basically, apply this expression to the position parameter of a layer that is parented to something else. It will, as expected, follow it's parent's position but on a delay dictated by the amount specificied.

delay = 0.2;

parent.fromWorld(toWorld([0,0,0],time- delay));

TIME

Basic but very useful. This will increase any parameter by 1 every second.

time

eg. time*40