Really quick for those who are new to After Effects so what is an after effects expression ?
An After Effect expression is a programming Javascript language code that you insert in any “Time-Vary stop watch” by pressing Alt-Click. See below
Over the years I have learn that after effects expressions can be very handy and powerful to make great motion graphics. It is amazing that with a few programming codes it can help make your animation moving organically. For those who have programmer brain which I don’t have 🙂 After effect Expression can significantly improve your workflow when you create an animation and with complex codes you can
actually achieve amazing motion graphics.
So let’s get to the real stuff, I found most of those useful after effects expressions list below on the web, to me they are the most used expressions unfortunately I don’t remember the ae expression owners name but I am happy to add a name next to those fabulous expressions if you know the programmer please shoot me an email or add a comment.
Also please like & Share
The Bounce Expression
This after effects bounce expression is very useful to make your animations and titles look dynamic with a nice elastic movement,
- Just create 2 keyframes position and past the code below.
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 && t < 1){ v = velocityAtTime(key(n).time - thisComp.frameDuration/10); value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t); }else{value} |
Download the AE bounce expression example here.
Automatic Fade
The automatic fade expression is useful when you don’t want to bother a create keyframes for a fade animation.
transition = 20; if (marker.numKeys<2){ tSecs = transition / ( 1 / thisComp.frameDuration); linear(time, inPoint, inPoint + tSecs, 0, 100) - linear(time, outPoint - tSecs, outPoint, 0, 100) }else{ linear(time, inPoint, marker.key(1).time, 0, 100) - linear(time, marker.key(2).time, outPoint, 0, 100) } |
Download the autofade expression example here
Squash and Stretch Scale Expression
This bouncing squash and stretch expression should make your animation a bit more alive by adding a proportional scale to your shapes or images.
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] |
Download The Squash and stretch expression example here
Ae Expression Source: http://motionscript.com/expressions-lab-ae65/squash-and-stretch.html
Loop
The Loop expression is probably to most used after effects expression, it allows you to repeat your animation
forever, with code tweak you can also control the loop time and repetitions.
loopOut("cycle"); |
Download The Loop expression example here
Looping Wiggle (by Dan Ebberts)
The looping wiggle expression become handy when you want an object to move randomly in your composition. Looping wiggle should be seamless and you shouldn’t see a cut, this expression is also used for background animation.
freq = 1; amp = 110; 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) |
Download the Loop Wiggle expression example here.
Time
Time expression is good for constant animation, the higher the number next to “time” below the faster your animation will be.
time*150 |
Rotate Multiplication
Rotate Multiplication is my favorite expression, basically it allows you to rotate multiple shapes around a center point and define how many shape you want this case below is 20 shapes layers until it make a circle. The rotate mutiplication is awesome to create circle burst animation. It is a bit complicated to explain how exactly how it work, so feel free to download my file after the animation below.
index*360/20 | \ |
Download The rotate multiplication expression example here.
Move Object X Pixel per Second
If your tired of making key frames, you’ll like this expression it allows you to move an object on the x axis per second.
veloc = 150; //Move object 150 pixel on x axis per second x = position[0] + (time - inPoint) *veloc; y = position[1]; [x,y] |
Download Move Object X Pixel per Second example here
Constant Rotation Per Second
Here is another After Effects rotation expression, no key frames needed to make a simple 360 rotation on a layer.
veloc = 360; //360 Degree Rotation per Second r = rotation + (time - inPoint) *veloc; [r] |
Download The Constant Rotation expression example here.
Motion Trail Expression
As you can see below with this motion trail expression you can get some pretty interesting animation of layers trailing .
//Apply to position delay = 5; //number of frames to delay d = delay*thisComp.frameDuration*(index - 1); thisComp.layer(1).position.valueAtTime(time - d) //Apply to Opacity opacityFactor = .75; Math.pow(opacityFactor,index - 1)*100 |
Download the motion trail expression example here
Script source: Motionscript
Blink Expression
The blinking expression become super handy when you don’t want to repeat a bunch of opacity keyframes over and over or want to animate a cursor quickly.
Simply add this expression below to your opacity properties.
blinkSpeed=15; n= Math.sin(time*blinkSpeed); if(n<0) 0 else 100; |
Download the blink expression AE project here
Also If you want to learn more I have created a big After Effects expressions list reference with demo examples and AE project source here.
thx so much…..av looked for them for along time
bouncing expression?????????????? help me with one
Just use Position or Scale element, and while clicking on the keyframe you need to hold alt in order to paste that Expression.
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;
}
Thanks bro
Hello, i need help.
I have my simple expression wiggle but i want it start after.
Explain:
My texte appears at 5:15 frames and i want the wiggle start at 6:00 frames but it starts when the text appears. Do you know which expression i have to use ?
If you can help me, it will be very friendly.
Cool. Thank you!
thanks
Hey, thanks a lot for this great info. Could you help me with squash effect? Keep getting an error.
please make post on more rotate multiplication.
I’m loving this, can’t wait to try them
this is very nice i am very thanks full to you my Dear its relay very good .
thank you
Hi, thanks for this scripts it is useful for my animation works also am using this for UI Animations.
thank you they are very useful
thank you
they were very useful to me
I found this very helpful, thanks
hello.
i have little bit diferent method to multiple rottation. You don’t need typing the number of objects, you just duplicate it (CTRL+D)
Paste my own code into rottation of object and duplicate multiple time:
layerCount = thisComp.numLayers;
offset = 360/(layerCount)*index
If You want start counting from specific layer, just add “-thisComp.layer(“your layer;”).index” at the end of the line one.
Enjoy!
Thanks. Could you guide me regarding after effects expression brief studies.