5 Mind-Blowing After Effects Expressions

In this After Effects tutorial, we will make distorted liquid stretch text, just in time for hot animator summer.

*** I did not write these expressions myself. I am not that smart even though I wish I was. Unfortunately, I do not remember where these came from, but I am assuming I saved them many moons ago from old Dan Ebberts posts.

Here are my picks for the top 5 mind-blowing expressions:

 
 

 
 

Loop Path Animations

try{ timeStart = thisProperty.key(1).time; duration = thisProperty.key(thisProperty.numKeys).time-timeStart; pingPong = false; //change to true value if you want to loop animation back & forth quant=Math.floor((time-timeStart)/duration); if(quant<0) quant = 0 if(quant%2 == 1 && pingPong == true){ t = 2*timeStart+ (quant+1)*duration - time; } else{ t = time-quant*duration; } } catch(err){ t = time; } thisProperty.valueAtTime(t)
 

Random Change to Specific Colors

colors = [[0,194,209,255]/255, [115,92,221,255]/255, [179,60,142,255]/255, [242,27,63,255]/255]; easeTime = .2; segDur = 2; curSeg = Math.floor(time/segDur); t = time%segDur; seedRandom(curSeg,true); idx1 = Math.floor(random(colors.length)); seedRandom(curSeg-1,true); idx0 = Math.floor(random(colors.length)); ease(t,0,easeTime,colors[idx0],colors[idx1])
 

Pro Tip: use color controls instead of typing in the colors codes in manually.

It will look like this:

colors = [effect("Color Control")("Color"), effect("Color Control 2")("Color"), effect("Color Control 3")("Color"), effect("Color Control 4")("Color")];

 

Ultimate Number Counter

slider = effect("Slider Control")("Slider"); //use angle control for > million numDecimals = 2; commas = false; dollarSign = true; percentSign = false; s = slider.value.toFixed(numDecimals); prefix = ""; suffix = ""; if (s[0] == "-"){ prefix = "-"; s = s.substr(1); } if(dollarSign) prefix += "$"; if(percentSign) suffix = "%"; if (commas){ decimals = ""; if (numDecimals > 0){ decimals = s.substr(-(numDecimals + 1)); s = s.substr(0,s.length - (numDecimals + 1)); } outStr = s.substr(-s.length, (s.length-1)%3 +1); for (i = Math.floor((s.length-1)/3); i > 0; i--){ outStr += "," + s.substr(-i*3,3); } prefix + outStr + decimals + suffix; }else{ prefix + s + suffix; }
 

Fade Layer Based on Start and End Points:

fade = 1; // fade duration in seconds fadeIn = (time - inPoint) / fade; fadeOut = (outPoint - time) / fade; if (time < inPoint + fade) { ease(fadeIn, 0, 1) * value; } else if (time > outPoint - fade) { ease(fadeOut, 0, 1) * value; } else { value; }
 

Trigger Opacity with Checkbox Control

if(effect("Checkbox Control")("Checkbox")==0) {0} else {100};

Pro Tip: You can swap the values inside { } for more custom results.

 
Previous
Previous

You’re Animating Text Wrong

Next
Next

Hot Liquid Stretch Text in After Effects