Expression Copied to Clipboard! πŸ—‚
← Back to Expressions

Loop a Wiggle - After Effects Expression

Seamlessly loop a wiggle expression (in seconds)

Loop a Wiggle

frequency = 2; // wiggles per second
amplitude = 40; // amount of pixels to wiggle
secondsToLoop = 3; // time to loop in seconds
// --------
t = time % secondsToLoop;
wiggle1 = wiggle(frequency, amplitude, 1, 0.5, t);
wiggle2 = wiggle(frequency, amplitude, 1, 0.5, t - secondsToLoop);
linear(t, 0, Β secondsToLoop, wiggle1, wiggle2)

‍

Copied to Clipboard!
frequency = 2; // wiggles per second
amplitude = 40; // amount of pixels to wiggle
secondsToLoop = 3; // time to loop in seconds
// --------
t = time % secondsToLoop;
wiggle1 = wiggle(frequency, amplitude, 1, 0.5, t);
wiggle2 = wiggle(frequency, amplitude, 1, 0.5, t - secondsToLoop);
linear(t, 0, secondsToLoop, wiggle1, wiggle2)

How to Use

Apply this expression to any property to get a random wiggle value that loops every n seconds.


frequency = the amount of wiggles per second


amplitude = the amount (pixels, percent) you want the wiggle to vary


secondsToLoop = how many seconds you want the loop to last


About

wiggle(f,a) is one of the most common and useful expressions for adding randomness and variation to properties in After Effects. However, it doesn't loop easily by default.

This expression allows you to create a looping wiggle by cleverly animating between 2 different wiggle expressions.


‍

Credit

Original expression by Dan Ebberts