You probably learned the Wiggle Expression early on in your After Effects career. In fact, it was the first tutorial I presented on my channel. But, there can be difficulties in making your Wiggle loop.
To do that, we need to create an expression. In fact, we’re going to create two wiggle expressions and switch between them by using a linear expression.
First, we need to set variables. We need a variable for frequency, amplitude and duration. Frequency is the wiggles per second, while Amplitude refers to the amount of pixels moved, or wiggled. Finally, duration is the loop time in seconds.
We can have something like this:
freq=4;
amp=50;
dur=2;
Next, we make two Wiggle variables and set them equal to a Wiggle expression. You may know that Wiggle usually has two values in parenthesis, the frequency and amplitude. But, Wiggle can have up to five values in the parenthesis. These are frequency, amplitude, octaves, multiple, and time. Octaves is the octaves of noise value, or complexity of the wiggle path. Multiple is the strength of the octaves. Time acts as an offset.
We also need a variable for time, both for these Wiggle expressions and our final Linear expression. So, we can have:
t = time % dur;
The percent sign acts as a remainder operator and returns the remainder left over when one operand is divided by another.
Then, we write our two Wiggle variables out. For example:
wiggle1 = wiggle(freq, amp, 2, 1, t);
wiggle2 = wiggle(freq, amp, 2, 1, t-dur);
Finally, we write a linear expression to tie this all together. The linear expression is written as:
linear(var, varmin, varmax, value1, value2)
In our case here, we’ll have:
linear(t, 0, dur, wiggle1, wiggle2);
Now, this Wiggle motion loops with our given loop duration. Watch this short After Effects tutorial:
Source link
Leave a Reply