ABCDEFGHIJ
1
FFFunctionNotes@ExpressionFunctionNotesUseful Plugin/ScriptDescription
2
http://www.shortcutworld.com/en/mac/After-Effects_CS5.htmlthisComp.layer(“Light 1“).toComp([0,0,0]);2D to 3D Null:beware! toComp/fromComp/toWorld/fromWorld/etc are complex and must be used carefullyhttps://github.com/chriskelley/work-scriptsA collection of scripts created for streamlining my compositing workflow in After Effects and Cinema 4D.
3
https://helpx.adobe.com/after-effects/using/keyboard-shortcuts-reference.htmllay = thisComp.layer("Shape Layer 2");
lay.toComp(lay.transform.anchorPoint);
2D to 3D Null (works better)
4
"alt" + "⇧" + "=" scpoint1=this_la;yer.position;
point2=this_comp.layer("Drag Me").position;
delta=sub(point1, point2);
distance=length(delta);
linear(distance, 0, 80, [250,250], [75,75])
Apple Magnifying effect (Scales up when it touches Drag Me)http://www.smipple.net/tag/ft-toolbarJS for ft-Toolbar
5
"⌘" + "alt" + "/"Remove ExpressionsloopOut("cycle",0) | loopOut("pingpong",0)Loopchange 0 to 1 to loop the last two k frames of the time remap. "cycle" for cycle looping or "pingpong" for pingpong loopinghttps://drive.google.com/file/d/0B7LFUuSb6Ow7bmtRQXYwWWxZUTQ/view?usp=sharingPaul's TypeIn_Interpolate preset. Explained in Expression comments.
6
let t = time-key(1).time;
let dur = key(numKeys).time - key(1).time;
valueAtTime( ((t%dur)+dur)%dur + key(1).time );
Loop Path in and Out
7
"+" and "-"Remove ExpressionsseedRandom(index,true);
myValue = random(50) ;
Frozen random number( missing ) :(http://www.batchframe.com/custom_controls/
8
"alt" + "["Cut in pointdelay = 5; //number of frames to delay
d = delay*thisComp.frameDuration*(index - 1);
thisComp.layer(1).rotation.valueAtTime(time - d)
DelayDELAY FOR SPECIFIC LAYER

lay = thisComp.layer("SquareMoves")
delay = 1; //number of frames to delay
d = delay*thisComp.frameDuration;
lay.rotation.valueAtTime(time - d)
https://www.dropbox.com/s/bgnf9hlxkezj2df/sw_BeatSequencer.jsx?dl=0Wrote this for a job i'm on, useful for placing layers or comps in time with music.

Select the layers you want to dupe, then a layer with Markers on it and hit the button.
9
"alt" + "]"Cut out pointlay = thisComp.layer("Null 3")
wrld=lay.toWorld(lay.position);
[wrld[0],wrld[1]]
connect to real world position of something (x, y)IF IT DOESN'T WORK (if you have the layer connected to a null for example) change it to the anchorPoint, so:
lay = thisComp.layer("Null 3")
wrld=lay.toWorld(lay. anchorPoint);
[wrld[0],wrld[1]]
https://bitbucket.org/snippets/kyletmartinez/
10
"⌘" + "⇧" + "d"Duplicate Layer in positionlay = thisComp.layer("Null 3")
wrld=lay.toWorld(lay.position);
[wrld[2]]
connect to real world position of something (z)IF IT DOESN'T WORK (if you have the layer connected to a null for example) change it to the anchorPoint, so:
lay = thisComp.layer("Null 3")
wrld=lay.toWorld(lay.anchorPoint);
[wrld[2]]
https://www.aenhancers.com/
11
"j"next keyframen=thisComp.layer("Null 2")
nullpos=n.toComp(n.anchorPoint);
fromComp(nullpos);
connect to real COMP position of something (x, y)ESPECIALLY PUPPET TOOL POINT TO NULL
12
In Timeline: Alt-click one keyframe, then anotherInfo panel shows duration between keyframesFaster than having to manually step through timeline to count framesL = thisComp.layer("Null 1");
L.toWorld(L.anchorPoint)
world positionhttp://docs.aenhancers.com/introduction/overview/AE Scripting Guide
13
"k"previous keyframeseedRandom(index,true);
freezeTime = random();
Math.min(time,freezeTime)
Random Freezed frameseedRandom(index,true);
freezeTime = random();
freezeTime = random(inPoint,key(2).time - thisComp.frameDuration)
14
"alt" + ","On/Off Proportional GridthisComp.layer("Controller").effect("Controller")("Slider")/50connect timeRemap to slider (0 to 100)
15
"alt" + "⇧" + "f"fit to screenposterizeTime(12);
value;
play precomp at 12 fps (even inside a 24fps comp)you can also do this: posterizeTime(comp("comp").frameDuration)
16
"alt" + "+" or "-"scale (hold shift for +-10)In Slider:
effect("Angle Control")("Angle")%360

In Time Remap:
effect("Angle Control")("Angle")/thisComp.frameDuration;
connect to timeRemap to Angle Slider/24 = frameRate
%360 = frames inside precomp
(1) = sometimes needed before %360

17
"⌘" + "Shift" + "k"keyframe velocitydistance=position[0];
circumference=width*Math.PI;
distance/circumference*360;
perfect wheel car simulation / rotationput the radius of your circumference (wheel) in the "width" spot in the expression
18
"⌘" + "Option" + "k"keyframe interpolation fps=15; //frequency
amount=50; //amplitude
wiggle(fps,amount,octaves = 1, amp_mult = 0.5,(Math.round(time*fps))/fps);wiggle(fps,amount,octaves = 1, amp_mult = 0.5,(Math.round(time*fps))/fps);
Jumpy Hold Wiggle: wiggle but with hold keyframesSimple, f - a parameters control speed and distance of jump
19
"⇧" + "esc"toggle between compsGo back and forth between actual comp and the previous one opened100 - thisComp.layer("OTHERLAYER").transform.opacity

alt:

x=thisComp.layer("OTHERLAYER").transform.opacity;
if(x<100) 100 else 0;
Opposite Transparency from layer to layer(missing) :(
20
ON TERMINAL:
kill ~SEGV #
if AE is froze, saves your project filefind after effects number on monitor. open terminal and put the action, replace # with AE monitor number.Wiggle with posterize!RANDOM each frame:

posterizeTime(0.000001);
wiggle(5,35);
21
"Command" + "Option" + "L"Reload selected footage itemsposterizeTime(12);
value;
Regular posterize to 12 fps
22
"Shift" + "F3"toggles between Timeline/Graph Editorw = wiggle(2,50);
[w[0],value[1]]
Wiggle only in X
23
"Shift" + "EE"Hides Expressionsw = wiggle(2,50);
[value[0],w[1]]
Wiggle only in Y
24
"x"Scrolls to first active selected layer. freq = .5;
amp = 20;
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)
Loop your wiggle!

loopTime = the length in seconds of your loop
25
⌘Eopens selected layer directly in PS, AI, Premiere, Cinema 4D… the original program used to create it.x = transform.position[0];
y = transform.position[1];
w = wiggle(3, 200);

[w[0], y];
wiggle in one direction
26
x = effect("Slider Control")("Slider")

Math.round(x/90)*90
wiggle in increments of 90°

you put the wiggle on the slider
and thats how you round to 90 degrees
you can swap out the two 90's for any other number
27
In Graph Editor: ALT-click any curveSelects all points on the curveThis sometimes ends up being a lot faster than having to marquee select the entire curve.[position[0], position[1],0.5* thisLayer.index];duplicate layer in z spacePaste it on the position parameter and start duplicating the layer
28
In Graph Editor: CTRL-click curveAdds additional points to curveFaster than scrubbing input to add a point to the curves=Math.exp(transform.scale[0]/21.667905)-1;
[s,s]
Exponential Scale
29
In Graph Editor: ALT-click any point on curveToggles between linear point and BezierFaster than having to open Keyframe Interpolation and encourages unique ease beyond standard Easy Easen=0;if(marker.numKeys>0){n=marker.nearestKey(time).index;if(marker.key(n).time>time){n--;}if(n==0){value;}
else{
t=time-marker.key(n).time; //time since marker
//Do Stuff
}} else value;
Trigger expression on markerReplace ‘//Do Stuff’ with code to be triggered at a maker. One use is to trigger keyframed animation from the begining of the layer (eg. valueAtTime(inPoint+t))
30
In Graph Editor: after selecting keyframe, hold down CTRL while moving keyEngages Snap function in curve editorCool thing about this is that the Snap function includes lots of stuff, like key values, work area, and the CTI. It's annoying to always turn the Snap button on and off — this makes it quick and painless.i = index-parent.index-1;Use with array expressions to measure the relative index from a layer to its parent/controller.
31
In Timeline: CTRL-click "Twirl Triangle" of a layerFolds and unfolds Layer attributesI use this to clean-up a layer that has lots of properties that can be twirled (like Particular), basically a reset button for a layer's UI; can also be used on complex folder hierarchies in Project windowvalueAtTime(framesToTime(linear(parentslider,0,100,-100,100)));Remap an animation on the first 100 frames using a slider from -100 to 100.Replace "parentslider" with the reference to your slider effect. Really useful for character rigging.
32
In Graph Editor: Graph OptionsOptions to show Timeline-centric info in the Curve EditorI turn on Show Layer Markers & Show Layer In/Out in that second dropdown at the bottom of the curve editor so I can make timing notes in the timeline with Layer Markers, but still see them in the Curve Editori = index-parent.index-1; parentproperty.valueAtTime(time+i*offset);Delay a property from a controller based on the relative index.Replace "parentproperty" with the controlling property.
33
In Graph Editor: Show PropertiesFilter on/off which curves are viewedEver turn on that little Graph Editor switch next to a properties keyframe — and now no matter what you select, that property is stuck in the GE? Turn off Show Graph Editor Set in the first dropdwon at the bottom of the GE to make it go away for the time being.xAmp = 3; //height of undulations (pixels)
xFreq = .3; //undulations per second
xSpeed = 150; //speed of wave (pixels per second)

wl = xSpeed/xFreq; //wavelength (pixels)
phaseOffset = ((position[0]%wl)/wl)*2*Math.PI;
y = xAmp*Math.sin(2*Math.PI*xFreq*time + phaseOffset);
value + [0,y]
undulating surface: POSITION
34
In Timeline: CTRL + ALT click keyframeConvert to hold keyframeA little faster than right-clicking and searching for Toggle Hold KeyframexFreq = .3; //undulations per second
xSpeed = 150; //speed of wave (pixels per second)
damping = 15; //undulation damping factor

wl = xSpeed/xFreq; //wavelength (pixels)
phaseOffset = ((position[0]%wl)/wl)*2*Math.PI;
theta = Math.atan(Math.cos(2*Math.PI*xFreq*time + phaseOffset));
radiansToDegrees(theta)/damping;
undulating surface: ROTATION
35
CTRL+SHIFT+ALT+UDisplay as wireframeQuality & Sampling toggle switch in the timeline is weird, only toggles between Best, Draft, and Bicubic. Useful to draw a particularly slow layer quickly without having to go full-on wireframe modeif (numKeys >1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
t = delta%span;
valueAtTime(t1 + t)
}else
value
Loop Mask AnimationApply to mask path of layer to loop keyframed masks.
36
delta = position - thisComp.layer("TARGET").transform.position;
radians_to_degrees(Math.atan2(delta[1],delta[0]))
`delta = toWorld(anchorPoint) - thisComp.activeCamera.toWorld([0,0,0]);
radiansToDegrees(Math.atan2(delta[0],delta[2]))
37
(hasParent) ? parent.opacity : value;Inherits opacity from parentThe additional bits of code catch any accidental unparenting
38
(hasParent) ? (parent.opacity/100) * value : value;Inherits opacity from parent but retains the child's editabiltyThe parent's opacity value acts as a mulitplier for the child's
39
nominalDist = 200;

d = length (thisComp.layer("Camera 1").toWorld([0,0,0]),toWorld(anchorPoint));
value*(d/nominalDist)
Takes parents position independently in one or more direction. With abality to adjust speed
40
nominalDist = 200;

d = length (thisComp.layer("Camera 1").toWorld([0,0,0]),toWorld(anchorPoint));
value*(d/nominalDist)
add this expression to the stroke width of a 3D shape layer to keep the same width no matter where in Z the layer is
41
try{
s = scale [0]/100;
L = thisLayer;
while (L.hasParent){
s *= L.parent.scale[0]/100;
L = L.parent;
}
w = value;
w/s
}catch(e){
value;
};
add to stroke width of shape layer to maintain stroke and path width during scalevalue/(scale[0]/100)

even when parented:

value / length(toComp([0,0]), toComp([0.7071,0.7071])) || 0.001;
42
value/(length(toComp([0,0]),toComp([1,0])) || 0.001);add to stroke width of shape layer to maintain stroke and path width during scale
43
value / length(toComp([0,0]), toComp([0.7071,0.7071])) || 0.001;add to stroke width of shape layer to maintain stroke and path width regardless of what the parent's scale OR shape layer's scale is
44
L = thisComp.layer("SPoint");
L.toComp (L.anchorPoint);


L = thisComp.layer("EPoint");
L.toComp (L.anchorPoint);
link Beam effect to two diferrent nulls
45
s = [];
ps = parent.transform.scale.value;
for (i = 0; i < ps.length; i++){
s[i] = value[i]*100/ps[i];
}
s
Maintain scale when parented
46
loopOut("continue");continue value of keyframes
47
colors=[
[141,203,235,255]/255,
[187,223,243,255]/255,
[164,213,239,255]/255,
[205,219,143,255]/255
];

amCol = 4 //Number of colours in the list above
colors[Math.floor(random(amCol-0.0001))];
random colours from range///If you want to hold colour, add:

seedRandom(1, true);
colors[Math.floor(random(amCol-0.0001))];
48
Add it to a null "position"Create smooth rolling credits (jgadpp.com)Create a null, go to Animation>Add Expression. Paste it. Then parent all your credits to the nullrate = 4; //value in px/sec.
value - [0,rate*timeToFrames(time)]
It will make your credits run smoothYou can change the rate value at your will.
49
sliderPos = thisComp.layer("Slider").effect("Slider Control")("Slider");
framesToTime((Math.round(sliderPos)))
TimeRemap to slider
50
w = wiggle(5,30);
[w[0],w[0]]
Wiggle Uniform Scale
51
w = wiggle(2,50);
[w[0],value[1]]
Wiggle Scale One Axis
52
// Throw (move at a constant speed without keyframes)
veloc =- 10; //horizontal velocity (pixels per second)
x = position[0] + (time - inPoint) *veloc;
y = position[1];
[x,y]
Constant move in axys X
53
delay = .05;
leader = thisComp.layer(1);
leader.transform.rotation.valueAtTime(time - delay*(index-leader.index));
Delay 2
54
.valueAtTime(time - 2*thisComp.frameDuration)add to the end of any expression to offset or delay the expression.
Helpful for precomps
//Specific Amount of frames:

delayFrames = -156; //Amount of frames (+/-)
delay = framesToTime(delayFrames);
comp("compname").layer("layername").transform.scale.valueAtTime(time-delay)
55
Ctrl+shift+Alt+right arrowadvanced keyframe
56
MasterC = "Master";
PreC = thisComp.name;

C = comp(MasterC);
L = C.layer(PreC);
Main_T = time + L.startTime;
allows you to source a master Audio comp to be nested/updated in all of your precomps. Useful when working with music/ VO found here
57
offset = -.5;
//The offset in time, negative half a second.

p = thisComp.layer("My Animated Layer");
//The parent layer

t = time + offset;
//The current time minus half a second

p.position.valueAtTime(t);
//Value of the parent's position property at the current time minus half a second
Delay 3
58
x=value[0];
y=100-x;
z=value[1]+y;
[x,z];
Scale x vlaue and have y value be +/- x's value.

when x= 80 y will = 120
when x= 120 y will = 80
Good for strech and squash
59
x=effect("x-size")("Slider");
y=effect("y-size")("Slider");
[x,y];
Same same but connect x-y to a slider
60
molt = -15;
y = thisComp.layer("LAYER NAME").transform.scale[1] * molt;
x = scale[0];

[x,y];
To scale up and move X up in the same time.
61
var num = (effect("Point Control")("Point")[0]);
num = Comma(num);
[num]

function Comma(number)
{
number = '' + Math.round(number);
if (number.length > 3)
{
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : '');
for (i=0 ; i < Math.floor(number.length / 3); i++)
{
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}
NUMBERS ABOVE A BILLION (https://www.youtube.com/watch?v=5WJmrYMifW8)
62
A = thisComp.layer("A").transform.position;
B = thisComp.layer("B").transform.position;
slider = effect("Slider Control")("Slider");

(A*slider)+(B*(1-slider));
Animating btween parentsadd the the position of both layers and mutiply them by a slider control (going 0 to 1). The trick is to multipy one of them by -1
63
A = thisComp.layer("A");
AA = A.toWorld(A.anchorPoint);
B = thisComp.layer("B");
BB = B.toWorld(B.anchorPoint);

slider = effect("Slider Control")("Slider");

(AA*slider)+(BB*(1-slider));
Animating btween parents - Comp positionadd the the position of both layers and mutiply them by a slider control (going 0 to 1). The trick is to multipy one of them by -1
64
65
x = thisComp.layer("Position Null").effect("Left/Right")("Slider");

y = thisComp.layer("Position Null").effect("Up/Down")("Slider");

value + [x,y]



If you want the sliders to control the absolute position, change the last line to:



[x,y]
Linking x an y position to null sliders separately
66
delay = .5;
parent.fromWorld(toWorld(anchorPoint,time-delay))
Delay from parent
67
https://www.youtube.com/watch?v=EcQ5kNSGwYAForce save when Ae freezes
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100