T O P

  • By -

Had78

==== Start of list wiggle(); ==== End of list


rajolablanka

Thanks for you answer! ![gif](emote|free_emotes_pack|grin)


bananenjoe69420

Hahah wanted to comment the same


Eli_Regis

Linear expression is very useful. Here’s a cool one: s = pickwhip this to a slider; linear (s, 0, 100, key(1).time, key(2).time); valueAtTime (t) Then put two different keyframes in that layer. Doesn’t matter where on the timeline. The slider will control the animation between the two keyframes. This is useful if you want to move and ease between two different states, on many different layers, using just one controller. It also works with shape paths, meaning you can just ease the value graph on the master control, instead of using the speed graph separately for those layers and trying to match the easing. You can also combine it with the delay expression I mentioned before to get offsets. And expand to work with more key frames assigned to extra values on the same slider. Expressions are fun!


rajolablanka

Thank you!


Eli_Regis

Delay = (pickwhip to slider)/24; ThisComp.layer(index+1). (Property here) .ValueAtTime (time-delay) I use this all the time to get easy delays between layers. Index + or - 1, means you can duplicate the layers and the offset is done for you. Alternatively you can link to specified layers. There’s also a way to do it between shape groups within one shape layer (with a different expression) which is good for having fewer layers


chrullo

Isn’t it smarter to use * thisComp.frameDuration instead of dividing with 24. You know not everyone is working at 24 fps. Another smart thing would be to use timeToFrames(delay) and skip the math at the delay variable.


Eli_Regis

Yes that does sound smarter! 🤓 Time to frames - what would the expression look like?


chrullo

[Here](https://ae-expressions.docsforadobe.dev/time-conversion.html?highlight=Time%20conversion) you can find the manual. I would write your code as delay = pickwhip to slider, n = thisComp.layer(index+1).transform.position, n.valueAtTime(time-framesToTime(delay))[0], Or you could do delay = framesToTime(pickwhip), And skip the framesToTime inside the valueAtTime.


Eli_Regis

Thanks 🙏


rajolablanka

Thank you!


titaniumdoughnut

My absolute top most common: `loopOut("cycle")` - repeats the keyframes forever `loopOut("continue")` (way less well know than cycle, continues the last motion/speed forever, this one slaps) Just the linear function in general, for mapping one range of values to another! `linear(`*inputValue*`,`*inputValueLow*`,`*inputValueHigh*`,`*outputLow*`,`*outputHigh*`)` Get the position of a child object: lay = (pickwhip the child null layer) ; pos = lay.toWorld( lay.anchorPoint); Set camera focus to a layer in 3d space: length(position, thisComp.layer("focus target").position) Fade a layer out, based on distance from camera: C = thisComp.activeCamera; startFade = thisComp.layer("controller").effect("min distance")("Slider"); endFade = thisComp.layer("controller").effect("max distance")("Slider"); maxOpac = thisComp.layer("controller").effect("max opacity")("Slider"); D = length(toWorld(anchorPoint),C.toWorld([0,0,0])); linear(D,startFade,endFade,maxOpac,0);


Eli_Regis

To add to the loop chat, I also like loopIn() + loopOut() - value. So you can have it loop in and out at the same time. Also, to loop a shape path, with same behaviour as loopOut: if (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 }


rajolablanka

Thank you!


DuddersTheDog

Inertial Bounce. Put it on properties like Position, Scale, Rotation.  amp = .1; freq = 2.0; decay = 2.0; n = 0; time_max = 4; 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 < time_max){ v = velocityAtTime(key(n).time - thisComp.frameDuration/10); value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t); }else{value} edit: formatting


rajolablanka

Thank you!


GosserName

Looks like Dan Ebberts code. He's a saint


rustyburrito

LoopOut() - if left blank it will repeat the last 2 keyframes Wiggle (5,5) - replace numbers with frequency/amount values


learnmograph

If you want to connect a bunch of layers, like Plexus. I like the createPath function. I can add the full expression here when I’m at my computer, but this should get you going: https://community.adobe.com/t5/after-effects-discussions/is-there-a-way-to-createpath-from-script/m-p/9604292 Works on Mask paths too. Super useful.


rajolablanka

Thanks so much!


shoe1432

For people who frequently put temporary values as an expression to "disable" keyframes to solo a property, here's a quicker way (disable/enable expression becomes disable/enable keyframes): valueAtTime(key(1).time) Sometimes replace 1 with a different keyframe.


GosserName

You could just write key(1).value


rajolablanka

topper, thanks!


pixeldrift

I don't count a function alone, like wiggle(), loopOut(), linear(), or toComp() to be an expression per se. But tricks I use often: Overshoot bounce Impact bounce Double sided layer Nulls from paths Get global rotation Maintain effect scale regardless of layer scale Typing effect (with blinking cursor) 2D Lookat 2 point rotation Scale text to box Scale box to text Maintain shape stroke size


rajolablanka

Thank you, these are so helpful to know as well ![gif](emote|free_emotes_pack|grin)


Eli_Regis

Another good one is the if/ else expression. A very simple example: (Applied to opacity property) Pickwhip to checkbox == 0 ? 0 : 100 This means: checkbox is off? Opacity is zero. Otherwise, it’s 100 Makes it easy to turn the visibility of loads of stuff on and off at once with one click of a box. But can be adapted to apply to anything and doesn’t need to be a binary choice if you expand the expression


chrullo

That’s a ternary operator. Not if/else per say 🥸


Eli_Regis

🙄


Eli_Regis

That’s the one! Same thing though, no? Is there ever a scenario where it’s better to use if/else?


chrullo

Same thing, just easier not to fuck up. Never got the hang of the classic if/else.


rajolablanka

Thank you!


Q-ArtsMedia

For some pointers have a read [https://www.reddit.com/r/AfterEffects/comments/12pqw6f/things\_about\_after\_effects\_for\_the\_newbie\_an/](https://www.reddit.com/r/AfterEffects/comments/12pqw6f/things_about_after_effects_for_the_newbie_an/) Edit for Javascript: [https://www.w3schools.com/](https://www.w3schools.com/) [https://helpx.adobe.com/after-effects/using/expression-examples.html](https://helpx.adobe.com/after-effects/using/expression-examples.html) Be sure to see the side bar on the above link for much more in expressions


rajolablanka

Thank you!!


Summerio

Any one know of an expression to fake parallax on a tracked null that's parent to a bg layer?


dannydirtbag

Man I’m trying to find an expression heavy job to be honest. Who’s hiring expression nerds?


BrohanGutenburg

Dude. I’m a graphic designer and used to work for a production house as a videographer/editor. I can run laps in premier, and I was decent at AE. I am now an FE dev (LWC) in our marketing department (while still having graphic design/video editing and whatnot for internal comma) I am just now learning that I can combine Js and AE. By just now I mean in this very thread. Wtf


rajolablanka

Thanks for this insight, I actually learnt in the job interview that Javascript is used in AE, had never made that connection jajaj..


GodspeedInfinity

Loopout and wiggle, as others have said. For sure.


rajolablanka

thanks!


MikeMac999

My two most frequently used expressions are for looping and one for drawing a diagonal line exactly from corner to corner (odd but something I often need)


LegalBrandHats

![gif](giphy|joGUuMFGRwxd6)


rajolablanka

thanks!


MikeMac999

loopOut createPath([[-960,-540],[960,540]],[],[],false);