Skip to main content
April 2, 2026Jerron Smith/4 min read

Creating Erratic Motion Effects with Random Expressions in After Effects

Master erratic motion with random expressions

Random vs Wiggle Expression Comparison

FeatureRandomWiggle
Motion TypeAggressive jumpsSmooth transitions
Value TransitionDirect jumpsInterpolates all values
Best Use CaseErratic switches/dialsNatural organic motion
Speed ControlRequires posterizeTimeBuilt-in frequency
Recommended: Use Random for mechanical, jumpy motion effects where smooth transitions aren't needed
Essential Setup Tip

Always position your anchor point at the center of rotation before applying random expressions to ensure proper rotation behavior

Adding Random Expression to Rotation

1

Access Expression Mode

Hold Option (Mac) or Alt (Windows) and click the stopwatch next to the rotation property

2

Clear Default Text

Remove the placeholder text that appears in the expression field

3

Add Basic Expression

Type 'random' in lowercase to create the basic random expression

4

Set Value Range

Add parentheses with min/max values like random(45, -45) to control the range

Default Random Value Limitation

Random by itself generates very small numbers (less than 1), which creates barely visible motion. Always specify minimum and maximum values for practical results

Frame Rate Impact on Motion Speed

Composition Default (30fps)
30
Moderate Speed (15fps)
15
Slow Motion (10fps)
10
Very Erratic (5fps)
5

posterizeTime Function Applications

Speed Control

Sets a custom frame rate for expressions, allowing you to slow down rapid random motion. Essential for creating controlled erratic movement.

Expression Optimization

Reduces computational load by limiting how often the expression recalculates. Improves performance while maintaining visual effect quality.

Universal Compatibility

Works with other expressions beyond random, making it a versatile tool for controlling any expression's update frequency.

Expression Syntax Requirements

posterizeTime must be the first line in your expression. Place it before random or the expression will fail. Use semicolons at the end of each line for proper syntax.

posterizeTime(10); random(45, -45);
Proper two-line expression format with posterizeTime controlling speed and random defining value range

Random Expression Analysis

Pros
Creates aggressive, jumpy motion perfect for mechanical elements
Completely overrides keyframes for consistent randomization
Works on any property: rotation, scale, opacity, position
Simple syntax with just minimum and maximum values needed
Cons
No built-in speed control requires additional posterizeTime function
Completely replaces existing keyframes without blending
Default values are too small for most practical applications
Less suitable for organic or natural-looking animations

Random Expression Implementation Checklist

0/6

This lesson is a preview from our After Effects Certification Course Online (includes software & exam). Enroll in a course for detailed lessons, live instructor support, and project-based training.

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.

Key Takeaways

1Random expressions create aggressive, jumpy motion that directly jumps between values without smooth interpolation, making them ideal for mechanical or erratic movement effects
2Unlike wiggle expressions, random does not include built-in frequency control and requires the posterizeTime function to manage animation speed effectively
3Always specify minimum and maximum values in parentheses with random expressions, as the default generates numbers less than 1 that create barely visible effects
4The posterizeTime function must be placed as the first line in your expression, followed by the random function, or the entire expression will fail to execute
5Random expressions completely override existing keyframes without blending, making them unsuitable when you need to maintain specific animated values
6Proper anchor point positioning is crucial before applying random rotation expressions to ensure the element rotates around the intended center point
7Frame rates between 5-15 fps using posterizeTime typically produce the most effective erratic motion, with lower values creating more dramatic jumping effects
8Random expressions work universally on any property including rotation, scale, opacity, and position, making them versatile tools for various animation scenarios

RELATED ARTICLES