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
The bounce expression is very useful to make your animations and titles look dynamic with a nice elastic movement, just make 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 bounce after effect 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; |