After Effects Expressions
Copy-ready expressions I use every day. Click a title to expand it, then copy the code.
text
Checkbox Visibility Toggle
Links a text or other property to a Slider Control on a control layer.
if (thisComp.layer("Checkbox").effect("Checkbox Control")("Checkbox") == 1) {
"Visible"
} else {
"Hidden"
}
Uppercase Text
Automatically converts all characters in the text layer to uppercase.
text.sourceText.toUpperCase()
Count Characters
Returns the total number of characters in the text.
text.sourceText.length
Slider Value Display
Adds custom text to the name of the current composition.
var slider = thisComp.layer("Controller").effect("Slider")("Slider");
"Value: " + Math.round(slider)
Layer Index Display
Returns the index position of the layer in the timeline.
thisLayer.index
Show Current Time
Displays the current composition time up to two decimals.
time.toFixed(2)
Rounded Slider Value
Rounds the value of a slider to the nearest whole number.
Math.round(effect("Slider Control")("Slider"))
Current Frame Number
Converts the current time into a frame number.
"Frame: " + timeToFrames(time)
Add Newline Text
Appends a new line to existing text using the newline character.
value + "\nNext line"
Default If Empty Text
Shows default text if the original source is empty.
if (text.sourceText == "") "No Text" else text.sourceText
Count Words
Counts the number of words in the text layer.
text.sourceText.split(" ").length
First Character
Returns the first character of the text layer.
text.sourceText.charAt(0)
After Effects Version
Displays the current version of After Effects.
"AE v" + app.version
Slider Plus Ten
Adds 10 to the value of a slider control.
parseInt(effect("Slider")("Slider")) + 10
Comp and Layer Info
Displays both comp name and current layer index.
thisComp.name + " – Layer " + index
motion
Simple Wiggle
Applies a basic wiggle expression for organic motion.
wiggle(3, 20)
Cycle Loop
Loops the keyframes in a continuous cycle.
loopOut("cycle")
Side-to-Side Motion
Creates a left/right sine wave movement.
freq = 2;
amp = 30;
wave = Math.sin(time * freq) * amp;
value + [wave, 0]
Motion Delay
Delays the animation by 0.1 seconds.
valueAtTime(time - .1)
Random Position Offset
Adds randomness to the layer's position.
value + random([-50, 50])
Pingpong Loop
Moves from 0 to 100 over 5 seconds linearly.
loopType = "pingpong";
loopOut(loopType);
Ease Motion
Creates eased animation between values over 1 second.
ease(time, 0, 1, 0, 100)
Link X Position
Links the X position to another layer while keeping Y intact.
temp = thisComp.layer("Null 1").transform.position; [temp[0], value[1]]
Motion Velocity
Calculates the speed of the layer’s motion.
velocityAtTime(time - thisComp.frameDuration)
Custom Sine Bounce
Applies oscillation using sine for bounce effect.
freq = 2; amp = 30; sin(time*freq)*amp
Vertical Bounce
Creates vertical bouncing animation.
value + [0, Math.sin(time*5)*20]
Step Jitter
Adds horizontal jitter on even-numbered frames.
timeToFrames(time) % 2 == 0 ? value : value + [10, 0]
Shift After 3 Seconds
Moves layer 100px after 3 seconds.
if (time < 3) value else value + [100, 0]
Wavy Scale
Applies wave effect to scale.
value * (Math.sin(time * 2) + 1)
Horizontal Speed
Returns horizontal component of speed.
thisProperty.velocityAtTime(time - thisComp.frameDuration)[0]
time
Increase Over Time
Multiplies time for progressive values.
time * 50
Sine Wave Animation
Oscillates value using sine.
Math.sin(time)
Pulse Animation
Creates pulsating animation from 0 to 1.
Math.abs(Math.sin(time * 2))
Ping-Pong Loop
Reverses animation back and forth forever.
loopOut("pingpong")
Linear Fade In
Transitions from 0 to 1 in 10 seconds.
startTime = 0;
endTime = 5;
startVal = 0;
endVal = 100;
linear(time, startTime, endTime, startVal, endVal)
Looping Ease
Repeats an eased transition every second.
ease(time % 1, 0, 1, 0, 100)
Frame-Perfect Time
Snaps time to the nearest whole frame.
framesToTime(timeToFrames(time))
Choppy Animation
Limits animation to 5 FPS.
posterizeTime(5); value
Unique Random Per Layer
Generates a consistent random value per layer.
seedRandom(index); random()
Toggle Every Second
Alternates value between 0 and 100 every second.
Math.floor(time) % 2 ? 100 : 0
Blink Every 5 Seconds
Creates cosine wave animation.
t = time % 5;
if (t < 1){
100
} else {
0
}
Blink for 1s Every 5s
Shows value for 1 second every 5 seconds.
time % 5 < 1 ? 100 : 0
Smooth Oscillation
Maps sine wave to range 0-100.
linear(Math.sin(time), -1, 1, 0, 100)
Time Multiplied By Slider
Scales time-based animation with slider.
time * effect("Speed")("Slider")
Pulse Between 50–150
Eased pulsing every 2 seconds.
ease(time % 2, 0, 2, 50, 150)
No expressions match your search.