Optimizing Procedural Motion: Beyond the Basic Wiggle Expression
Learn how to master the After Effects wiggle expression with seedRandom to create deterministic procedural motion without sacrificing project performance.
01 Oct 2025, 01:01 UTC

Manually keyframing organic movement—like a camera shake, a flickering light, or a floating UI—is a time sink. While you can plot keyframes to simulate randomness, the result is rigid and difficult to adjust later. The solution is usually the After Effects wiggle() expression, but simply dropping a line of code onto a property often leads to unpredictable motion that is impossible to control or causes performance bottlenecks as the project grows.
The Mechanics of the Wiggle
The wiggle(frequency, amplitude) function uses a noise algorithm to generate random values. The frequency determines how many times per second the value changes, while the amplitude determines how far the value strays from its original state. For example, wiggle(5, 50) tells After Effects to move the layer five times randomly by up to 50 pixels.
The primary issue with the basic wiggle is that it is non-deterministic by default. If you add new layers or change project settings, the "random" path might shift, breaking your composition's timing. To build professional-grade motion, you need to lock that randomness to a specific state.
Locking Motion with seedRandom
To ensure your animation stays consistent, you must use the seedRandom() function. This function sets the starting point for the random number generator. By setting the second argument to true, you tell After Effects to seed the random only once when the expression is evaluated, rather than every frame.
Here is a standard configuration for a locked wiggle on the Position property. Apply this by Alt-Clicking (Windows) or Option-Clicking (Mac) the stopwatch:
seedRandom(42, true); wiggle(3, 20);
In this example:
seedRandom(42, true): The number 42 is the seed. You can change this to any integer to get a completely different, but consistent, motion path. Thetrueensures the seed doesn't reset every frame.wiggle(3, 20): The layer moves 3 times per second with a 20-pixel range.
Performance Trade-offs
While expressions reduce file size because they store a string of text instead of thousands of keyframe points, they cost CPU cycles. After Effects calculates these expressions in real-time. If you have hundreds of layers with complex, nested wiggles, your RAM preview (cache) will lag significantly.
To optimize, consider using a "Null Object" strategy. Instead of applying a complex wiggle to 50 individual layers, apply it once to a hidden Null Object. Then, use a simple link expression on the other layers to follow the Null's position:
thisComp.layer("Null 1").position;
Verification Strategy
To verify your expression is working correctly, change the seed number in seedRandom(). If the motion jumps to a new path but remains smooth when you hit playback, the true flag is working. If the motion flickers or resets erratically, the seed is likely set to false.
Takeaway: Use wiggle for organic motion, but always wrap it in seedRandom(index, true) to ensure your animation doesn't break when you continue working on the project.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.