After Expressions are an incredibly powerful feature of After Effects.
The list below contains some helpful After Effects expressions for you to use in your compositions.
/**
* The following expression will allow you to access the layer above
* See the examples below for how to use it in practice
*/
thisComp.layer(index-1);
/**
* The following expression will allow you to access a layer
* in a different after effects comp
* Replace COMP NAME with the composition name
* Replace LAYER NAME with the specific layer name
*/
comp("COMP NAME").layer("LAYER NAME");
//to increase the speed of the animation, increase the freq value
freq = 1;
100*Math.sin(time*freq*Math.PI*2);
/**
* The following expression will format a number variable as currency
*/
var num = [YOUR NUMBER HERE];
num.toLocaleString("en-GB", { style: "currency", currency: "GBP", currencyDisplay: "narrowSymbol"});
//Replace [TIME VALUE] with a number or time value
timeToTimecode([TIME VALUE]);
var comp_width = thisComp.width;
var comp_height = thisComp.height;
var centre_x = thisComp.width / 2;
var centre_y = thisComp.height / 2;
[centre_x, centre_y];
/**
* Replace type with one of the following values:
* "cycle" - this will repeat your animation from the beginning
* "pingpong" - alternates back and forth between keyframes
* "offset" - similar to cycle, only this will offset the values by the original
* "continue" - carries on the animation with the same velocity as the last keyframe
*/
loopOut(type);
/**
* The following expression will format a number with
* separators in After Effects
*/
var num = [YOUR NUMBER HERE];
num.toLocaleString();
/**
* The following expression will remove any decimal points
* that may appear from a slider animation
*/
Math.floor(effect("Slider Control")("Slider"));
/**
* Use the toFixed(); function to limit a value to a specifed number of decimal places
* Replace "NUMBER OF DECIMAL PLACES" with a number
*/
effect("Slider Control")("Slider").value.toFixed(NUMBER OF DECIMAL PLACES);
/**
* Replace the word "frequency" with the number of
* times you want something to wiggle per second.
* Replace the word amplitude to change the size of
* the wiggle e.g: how much you want to wiggle by
*/
wiggle(frequency, amplitude);