The After Effects wiggle expression is perhaps one of the most well-used expressions in any motion designer’s toolkit.
In its most basic form, the wiggle() expression needs two parameters: frequency and amplitude (in that order). The frequency value controls how many times per second the wiggle will occur. The amplitude value controls the size of the wiggle.
So for example, if we had a wiggle expression with the values: wiggle(3,50); - this would mean our wiggle happens 3 times a second, and the value being wiggled would change by plus or minus 50.
But what happens if you need to control the amplitude or frequency of your wiggle expression?
Well, there is a pretty simple way of doing this: all you need to do is link the two wiggle parameters to two different slider controls. Once the parameters are linked, you can then keyframe your slider controls however you like to create a more dynamic and interesting wiggle.
How to set up your wiggle expression:
For this example we’ll wiggle the position of a 2D text layer.
The first step is to create the two slider controls we’re going to link the wiggle expression values to. So to do this, search “Slider Control” in the Effects & Preset panel and then drag and drop it onto your layer.
In the Effect Controls Panel you should now see the slider control on your layer.
Click on the slider’s name (usually: Slider Control), hit the return key and rename it to: Amplitude.
Once you’ve renamed your first slider, select it again in the Effect Controls Panel and choose CMD+D (or Edit > Duplicate) to duplicate it.
Rename this second slider from Amplitude 2 to Frequency.
Now we’ve got the two sliders, we can create the wiggle expression and link all the values up.
Select the property you want to apply your wiggle to, in this example we’ll select the position, and then Option-Click the little stopwatch icon to open up the expression controls (alt-click if you’re on a PC).
Next, add the following expression:
var amp = effect('Amplitude')('Slider');
var freq = effect('Frequency')('Slider');
wiggle(freq,amp);
What this expression does is create a variable for each of the slider controls we created, it then uses these variables for the frequency and amplitude parameters of the wiggle expression.
With the expression all setup, you can then customise the values of each slider control to whatever you like and more importantly: you can also keyframe these values as well!
So if you wanted to have a wiggle that gradually gets faster and faster: just keyframe the frequency slider from 0 to 100 for example.
Only want to wiggle up and down?
Check out the free Jiggle script to wiggle in only one direction!