After Effects Scripts

Layer distribute in z space in relation to layer number

[value[0], value[1], value[2]-index]

Bounce Script

Here is a very handy AE script for making you graphics bounce when they scale or move in.

amp = .1;

freq = 2.0;

decay = 2.0;

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


Change the values of the amp, freq and decay to change the speed and amount of bounce.


Lens Flare Track

This lovely little script tracks the movement of an element in 3D space and maps it onto the position of you lens flare.

L = thisComp.layer(“Flare”);L.toComp([0,0,0]);

Just change the name of the layer you want to track to Flare.

Match camera focal plane to another layer

target = thisComp.layer(“target”);
V1 = target.toWorld(target.anchorPoint) – toWorld([0,0,0]);
V2 = toWorldVec([0,0,1]);

Fade opacity of a 3D layer based on distance from camera

startFade = 500; // Start fade 500 pixels from camera.
endFade = 1500; // End fade 1500 pixels from camera.
try{ // Check whether there’s a camera.
C = thisComp.activeCamera.toWorld([0,0,0]);
}catch(err){ // No camera, so assume 50mm.
w = thisComp.width * thisComp.pixelAspect;
z = (w/2)/Math.tan(degreesToRadians(19.799));
C = [0,0,-z];
P = toWorld(anchorPoint);
d = length(C,P);


loopOut(type = “cycle”)

loopOut(type = “pingpong”)

loopOutDuration(type = “cycle”, duration = 1)

Change the duration to add a gap

Clock Hands

thisComp.layer(“Deep Red Solid 2”).transform.zRotation/12

Script Links


graymachine my top expressions


adobe expression examples



After Effects Exchange

A handy file I made for creating funky 3D text, with animated reveal

Design and animation


Leave a Reply