AE EXPresSionS

FOR AFTER EFFECTS

Rotate Forever

Create a text and add this expression to the layer's rotation property or any that uses degrees: [overtime*howmanyrotations]

time*200

Wiggle Forever

Can be applied to any property, but works better on the position to create a natural camera movement. [wiggle (speed,distance)]

wiggle(1,50);

loopOut Forever

There are 4 common types of loopOuts: Cycle, PingPong, Offset, and Continue. Create a text for example and move it from left to right or just scale it up, then add any of the loopOut expressions to the same property you used (remember to always write loopOut with l lowercase O uppercase)

loopOut("cycle") 
loopOut("pingpong") 
loopOut("offset") 
loopOut("continue")

Inertia

To use inertia bounce simply copy paste the expression in the text box.

// 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 = .05;
freq = 2.0;
decay = 6.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}

Then just add the keyframes. The expression will do the rest! You can also edit any of these values to get different results.

amp = .05;
freq = 2.0;
decay = 6.0;

Create a Timecode

Create a text layer and apply the expression to the source text attribute:


var hour = Math.floor((time/60)/60);
var min = Math.floor(time/60);
var sec = Math.floor(time);
var mili = Math.floor(time*60);
// Cleaning up the values
if (mili > 59){ mili = mili - sec*60; }
if (mili 59){ sec = sec - min*60; }
if (sec = 59){ min = min - hour*60; }
if (min < 10){ min = "0" + min; }
// no hour cleanup
if (hour < 10){ hour = "0" + hour; }
//Output
hour + ' : ' + min + ' : ' + sec + ' : ' + mili;

Bounce

First create an animation (ie. scale 100 to 120% or position from left to right). Next apply the following expression to the same property:

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

Squash and Stretch

Apply it to the scale attribute of any object: (Works best on icons or bullet points)

maxDev = 13; // max deviation in pixels
spd = 30; //speed of oscillation
decay = 1.0; //how fast it slows down
t = time - inPoint;
x = scale[0] + maxDev*Math.sin(spd*t)/Math.exp(decay*t);
y = scale[0]*scale[1]/x;
[x,y]

Motion Tail

First animate the position of an object. Then apply the following expression to the position:

delay = 5; //number of frames to delay
d = delay*thisComp.frameDuration*(index - 1);
thisComp.layer(1).position.valueAtTime(time - d)

//And this code to the opacity:

opacityFactor = .75;
Math.pow(opacityFactor,index - 1)*100


Now simply duplicate that entire layer (CTRL + D / CMD +D) a couple of times.