Although After Effects (AE) is a fantastic tool for creating UI animation prototypes, we're constantly searching for methods to make our process go more quickly. Expressions are supported by AE and allow the designer to animate layers without manually specifying each keyframe by establishing connections between layer parameters or keyframes. We'll go through the fundamentals of using and defining expressions as well as how to adapt them to your own need.
In this article
Part 1. What is After Effects Expression
You may begin forming connections between a property and other layers when you write an expression on that property. By connecting the expressions to the numerical parameters, the expression controllers in the Effects & Presets panel may assist you in better controlling the expressions. Although they are by no means necessary, expressions come in quite handy when attempting to replicate effects like inertia or bouncing without having to specify a ton of extra keyframes. They not only provide many creative possibilities, but they may also streamline your motion design process.
Part 2. Common Expressions in After Effects
Expressions in After Effects revolve entirely on manipulating values inside an object hierarchy. Objects in this context include the composition, specific layers, and even effects. Values or other things may be contained by an object.
Use thisComp together with some fundamental arithmetic to precisely place things on the screen. This comes in quite helpful when exporting several versions for social media sites and reusing content. To have the logo scale in accordance with the size of the comp, you could even add a similar statement to the Scale option.
You can always simply copy and paste keyframes throughout the timeline if you want an animation to repeat. But if you wanted to make adjustments, you'd have to go back and deal with all of those keyframes again. Again, you'd never see Batman using After Effects accomplishing this. You should use the loopOut expression in these circumstances. Even four options may be used to modify how the animation loops.
Again, cycle is the default setting; however, you may also choose from continue, offset, and ping pong. It just requires animating an Ellipse's Scale and Opacity properties, then adding loopOut to each of them. The two keyframes are immediately cycled; it is plug and play. There are really just four keyframes in total, however the animation lasts the full length of the timeline. Use two keyframes per parameter to keep things simple, or specify which keyframes you want to loop to make things more complicated.
As implied by the name, each frame's value is generated randomly by this expression based on the argument you provide. It will automatically randomize between 0 and 1 if you leave it empty. The parameter will generate a value at random between 0 and the value you provide between the parentheses. It will generate random numbers between the two values you enter.
Another excellent expression for rapidly producing an animation is this one. We often use it to make opacity transitions that flicker. It just takes a few clicks to do this by adding the phrase below to Opacity and keyframing it in and out from 100% Opacity.
One of the few expressions that may be used without keyframes is the Wiggle expression. Watch your shape begin to wiggle by simply adding the phrase to any Transform attribute. It will jiggle between keyframes if you decide to add them.
You will simultaneously move in two dimensions while using this phrase. You may sometimes just need to jiggle one dimension. The After Effects Wiggle expression (also known as AE Wiggle) is an excellent tool for creating erratic item movement, idle character movement, unpredictable camera motion, shaky lettering, and flashing lights.
The greater the value next to "time" below, the quicker your animation will be. Time expression is useful for continuous animation. Utilizing time is one of the fastest and simplest methods to create an animation. Time just creates each second's numerical value in the timeline. Remember that regardless of the timecode settings, this number begins at zero at the beginning of the comp.
Again, combine this with some simple arithmetic for excellent outcomes. To find a multiplier value that works for the parameter you are animating, play around and explore. Use it to gradually modify a layer's position or rotation. Time is also very useful for driving animated textures like the Fractal or Turbulent Noise effects. The evolution parameter is increased by a factor of 100 throughout time.
Part 3. How to Add Expressions in After Effects
In Adobe AE, expressions may be added to any kind of layer and any form of layer attribute. Don't give up; one of the best things about expressions is that you don't have to be an expert programmer or coder to use them. A variety of transform effects may have expressions applied to them to generate fascinating animation, which might take hours to create from scratch.
While some idioms are brief, simple, and easy to use and comprehend, others are wordy and complex. Even though they can appear difficult, sticking them in their designated spot should work. The process of adding expressions is always the same; the code varies based on your goals. Learning how to apply an Expression effect to your layer is the first step.
Step1 Include your form or image in the timeline. When viewing the layer's properties, click on the stopwatch of the property you wish to apply the phrase to while holding "Alt" (PC) or "Option" (Mac).
Step2 Make two keyframes for the transformation you've selected; in our case, we’ve point it Beginning and the End frames as shown below:
Step3 Go to the Animation menu and choose the Transform option you keyframed in the timeline. We are choosing Scale since it is what we keyframed. Multiple Transform settings may have expressions added to them, but you should do it sequentially.
Step4 A box will show up on the timeline after choosing Add Expression from the menu. In the box, paste your expression. The numerical parameters will become red and a text box will show up in the timeline below the layer. The Expressions will be typed or copied here. By adjusting the values in the code, you may fine-tune the expression; experiment with each to find what works for you.
Part 4. How to Edit Expressions in After Effects
Step1Select the property in the Timeline panel, then choose Animation > Add Expression to add and reveal an expression. To search Expressions and other parts of a property, use the search box in the Timeline panel.
Step2In the Timeline panel or the Effect Controls panel, click the stopwatch button next to the property name using the keyboard shortcut Alt + click for the Windows or Option + click for the MacOS. Four icons are shown under the property while the expression is active, and the value becomes red.
Step3To open the Expression Editor, click within the text box on the Timeline panel. Wherever you wish to alter the phrase, position the cursor. The pick whip may be moved to the name or cost of a property. The resultant expression shows all the values as one if you drag to the name of a property.
Step4Press Enter on the numeric keyboard to end text editing and start the expression.