Using Wiggle to Create Random Movement in After Effects
Use an expression to create random movement with the wiggle expression in After Effects. In this post we’ll show you how to create wiggle easily by modifying numbers…not keyframes.
Editors sometime cringe at the word expressions, but have no fear. When you understand them they really aren’t scary and can end up saying you a lot of time.
If you’ve ever seen animations where light is flickering or a camera shakes, it’s likely you’ve seen the wiggle expression in action. Wiggle is one of the most popular After Effects expressions, as it is easy to use and visually interesting. Instead of creating a bunch of keyframes to make a layer randomly move, we can do this with a couple of numbers.
The Wiggle Expression in After Effects
For this example I created the word ‘wiggle’ from text. I want the position of this text to wiggle, so select the text layer and hit P to open the Position Transform properties.
Option (Mac) or Alt (PC) click on the stopwatch to create the expression. The text turns Red, telling you there is an expression applied.
Type wiggle(2,50). This expression states that twice a second the text should wiggle 50 pixels on the x & y axis – the first number is how many times a second, the 2nd is the amount of pixel movement.
If you want to modify the wiggle simply change the numbers. If we had done this with keyframes, every time the client wanted changes we would have to change the keyframes – not fun!
Wiggling One Dimension
What if you want to wiggle just the x or y position? This expression is a little more complicated, but you don’t have to write it.
I went to motion-graphics-exchange.com (an online resource for After Effects expressions), and searched for “wiggle one dimension”. This is the expression they have for ‘wiggle in one dimension’:
wiggle only in x (horizontal):
org=value; temp=wiggle (5,50); [temp,org];
wiggle only in y (vertical):
org=value; temp=wiggle (5,50); [org,temp];
Copy this text into your After Effects project and you’re done!
Controlling the Wiggle Expression
What if you don’t want the layer wiggling constantly? A common technique is to add an expressions control to a null layer so we can keyframe the wiggle. For AE newbies, a null is an object that doesn’t render that we can use to control other layers.
We are going to use the null with the original position wiggle we created on the Wiggle text (above).
From the Layer Menu select New and then Null Object. Rename the Null “wiggle control” and then apply the effect “Sliders Control” (in the Expressions Controls category).
Select the wiggle control layer in the timeline, and type E to reveal the Slider Control effect. Click the twirly for Slider Control to see the stopwatch.
Go to the Wiggle text expression and select just the 2. with the 2 selected, click the pickwip (looks like a curly cue), and drag the pick whip to the Slider stopwatch.
Pick whip is highlighted in Red:
Here is the larger view:
We no longer see a wiggle, as the Slider is now controlling how many times a second the text wiggles. Click the stopwatch to create a keyframe at the beginning, then move the playhead further in time and change the amount for the Slider to increase the wiggle. You can turn on motion blur to enhance the effect.
Motion Blur Highlighted in RED (click for larger view):
Now you know how to create a wiggle expression in After Effects and how to control it using a null and an expression slider effect – a huge timesaver.
What After Effects expressions do you rely on?
Share them with us in the comments below!