In this tutorial, we'll explore the random expression—a powerful tool for creating erratic, unpredictable motion in After Effects. Unlike the smoother wiggle expression, which interpolates between values to create fluid movement, random delivers sharp, instantaneous jumps that can simulate mechanical glitches, electrical interference, or broken equipment behavior.
The key distinction is immediacy: random selects discrete values without transition, making it ideal for creating aggressive, on-off effects that feel more chaotic and unstable than wiggle's organic motion. This makes random particularly effective for technical animations, UI glitches, or any scenario where you need movement that feels distinctly digital or malfunctioning.
For this demonstration, we'll work with a dial element that needs erratic rotation. First, let's properly position the anchor point at the dial's center—this is crucial for realistic rotational movement.
Here's where After Effects' snap feature can become counterproductive. We'll disable it to gain precise manual control over anchor point placement. I'm positioning the anchor point by eye at the circle's center, which often produces more natural results than relying on automatic snapping.
Let me test the rotation to ensure our anchor point is correctly positioned. Perfect—the dial rotates naturally around its center point, which is exactly what we need for convincing animation.
Now I'll reset the rotation value to establish our starting position. This gives us a clean baseline from which our random expression can operate.
To fit the composition back into the viewer window, I'm using Option+/ (Alt+/ on Windows)—a essential keyboard shortcut for efficient workflow. You can also access this command through the magnification menu in the lower left corner using "Fit Up To 100%".
Now for the core technique: adding random motion to the rotation property. Hold Option (Alt on Windows) and click the rotation stopwatch to enable expressions. This reveals the expression editor, which only appears in the timeline panel and is essential for procedural animation.
Notice how After Effects provides helpful tooltips—hovering over the stopwatch reminds you that Option/Alt+click enables expressions. The default placeholder text that appears must be completely removed before writing your expression.
The basic random expression is simply "random" (always lowercase). However, running random without parameters produces extremely subtle movement—barely perceptible values less than 1 degree. This is rarely useful in practical applications.
To create meaningful motion, we need to specify minimum and maximum values within parentheses. For this dial, I'll use random(45, -45), which generates random values between positive and negative 45 degrees. The order doesn't matter for rotation properties, but establishing clear ranges is crucial for predictable results.
This produces much more dramatic movement, but reveals random's primary limitation: speed control. Unlike wiggle, which includes a built-in frequency parameter, random operates at the composition's frame rate by default—often 24, 30, or even 60 frames per second. This creates frenetic, unusable motion.
The solution is posterizeTime, a companion expression that artificially reduces the frame rate for specific properties. This powerful technique allows granular control over expression timing without affecting your entire composition.
Adding posterizeTime requires a multi-line expression. Position your cursor before "random," press Return to create a new line above, then type "posterizeTime(15);" to set a 15 fps rate for this expression only. The semicolon marks the end of the statement—professional practice dictates adding semicolons to all expression lines, even though the final line doesn't strictly require one.
Now our dial updates at 15 fps instead of the composition's native frame rate, creating much more controllable, deliberate motion. This technique is invaluable for matching animation to real-world mechanical behavior or creating stylized digital effects.
Experimenting with different posterizeTime values yields dramatically different results. Try 5 fps for extremely erratic behavior, or 1 fps for slow, dramatic state changes. For this demonstration, 10 fps provides an optimal balance of randomness and usability.
Understanding random's behavior is crucial: it literally jumps between values without interpolation, creating harsh, mechanical motion that's impossible to achieve with traditional keyframes. This makes it perfect for simulating equipment failure, digital noise, or intentionally jarring effects.
The random expression's versatility extends beyond rotation—apply it to opacity for flickering lights, scale for unstable sizing, or position for chaotic movement. However, remember that random completely overrides any existing keyframes on the affected property. If you need specific timing or values, use keyframe animation instead.
The order of multi-line expressions matters critically. posterizeTime must appear first to establish the frame rate before random executes. Reversing this order will cause expression failure—a common mistake that can frustrate newcomers to expressions.
This combination of random and posterizeTime represents fundamental After Effects expression techniques that remain relevant in 2026's motion graphics landscape. Whether you're creating UI animations, technical visualizations, or stylized motion graphics, these tools provide precise control over procedural animation that would be impossible to achieve manually.