How To Use The Wiggle Expression In Adobe After Effects

The Wiggle Expression in After Effects is a powerful tool that allows objects to move in a random pattern, enhancing animations like camera shakes or flickering lights. To utilize it, select the desired layer property, apply the expression, and adjust the frequency and amplitude parameters.

December 4, 2024
How To Use The Wiggle Expression In Adobe After Effects
Video Editing On Steroids!
ULTIMATE Tools for creating high-quality video content
15M+ Assets
for After Effects, Premiere Pro, FCPX & DaVinci!

Using JavaScript To Make An Element Wiggle In Adobe After Effects

What is the Wiggle Expression in After Effects?

The Wiggle Expression in After Effects, often referred to as AE Wiggle, allows objects to move in a random pattern. This can be used to create effects like a random camera shake, a flickering light, or even to give character joints a more natural, idle movement. It's a popular expression that many motion designers, including myself, find invaluable in various projects.

Basic Wiggle

This is the basic wiggle expression for a simple random movement.

wiggle(5, 10);

Slow and Far Wiggle

Wiggle that moves the object far but at a slower rate.

wiggle(1, 70);

Medium Wiggle

A moderate wiggle that's faster than the previous but doesn't move as far.

wiggle(3, 20);

Fast and Short Wiggle

A quick wiggle that moves the object in short distances.

wiggle(11, 7);

What Are Expressions in After Effects?

Before we delve into the Wiggle Expression, it's essential to understand what an expression is. In After Effects, an expression is a small piece of JavaScript code that you can apply to animated properties in your projects. This code evaluates to a single value for a specific layer property at a particular time. In simpler terms, you're setting a layer property value through code. For instance, properties like "Scale," "Position," or "Rotation" can be controlled using expressions. While it might seem daunting to think about coding, especially for those of us who identify more as creatives than coders, using expressions can significantly streamline your workflow and enhance your projects.

At its core, the wiggle expression generates random values for your selected property—like position, scale, or rotation—over time. It’s written in the Expression Editor, a scripting interface in After Effects where you can apply simple or advanced coding to properties. For wiggle, the syntax looks like this:

  • wiggle(frequency, amplitude)
    • Frequency: Determines how many times per second the wiggle effect occurs.
    • Amplitude: Defines how far the wiggle moves from the original value.

For example, wiggle(3, 50) would make the property wiggle three times per second with a range of 50 pixels, degrees, or percentage points depending on the property.

How to Use the Wiggle Expression:

  1. Adding an Expression: To add an expression, first, select the layer property you want to apply it to. You can access these properties by twirling down the small arrows on your layer or using hotkeys like "a" for Anchor, "s" for Scale, or "p" for Position. Once you've selected the property, right-click and choose "Edit Expression" or ALT-click the stopwatch icon next to the property. This will open the Expression Script Window in your timeline, where you can input your code.
  2. Writing the Wiggle Expression: A basic form of the Wiggle Expression looks like this: wiggle(5, 10);. Here, the first number (5) represents the frequency, indicating how fast the value should wiggle. The second number (10) denotes the amplitude, defining how far the value will wiggle. So, in this example, the value will wiggle five times per second and move up to 10 units (like pixels) from its original position.
  3. Advanced Usage: The Wiggle Expression can be expanded to include more parameters, allowing for more control. For instance, if you want to wiggle only in one dimension, such as the x-position, you would use variables and arrays to achieve this effect. This might sound complex, but with a bit of practice, it becomes second nature.
  4. To loop it, read here.

Where to Use Wiggle

The wiggle expression works on virtually any animatable property. Here are a few common use cases:

  1. Camera Shake: Add it to the position property of a camera layer to simulate handheld footage or dramatic action.
  2. Organic Motion: Use it on objects like text layers, logos, or shapes to give them subtle, random movement, making your design feel more alive.
  3. Flickering Effects: Apply wiggle to opacity or color properties for a randomized flicker, perfect for simulating light bulbs or glitch effects.

Combining Wiggle with Other Expressions

Here’s where it gets interesting: you can combine wiggle with other expressions to fine-tune the effect. For instance, if you want the wiggle to stop after a certain point, you can use conditional statements:

  • if (time < 2) { wiggle(3, 30);} else { value;}

This expression wiggles for the first two seconds of your timeline and then freezes.

Controlling Wiggle with Sliders

If you’re a fan of keeping your workflow neat and organized (and who isn’t?), you can link the wiggle expression to Slider Controls. This way, you can adjust frequency and amplitude directly from the Effect Controls panel without diving back into the Expression Editor.

Here’s how:

  1. Add a Slider Control to your layer (found under Effects > Expression Controls).
  2. Alt-click the stopwatch on your property, then type:
    1. wiggle(effect("Frequency Slider")("Slider"), effect("Amplitude Slider")("Slider"))
  3. Now, tweak the sliders for real-time adjustments.

Pro Tips for Using Wiggle

  • Don’t Overdo It: Subtle wiggles often look more professional unless you're going for a chaotic, energetic style.
  • Smooth It Out: For smoother motion, reduce the frequency and increase the amplitude.
  • Stay Organized: When working on complex compositions, label your sliders and organize your layers for easier management.

Why Wiggle is Essential

The wiggle expression isn’t just a fun gimmick—it’s a powerful tool for motion graphics. It saves you from repetitive tasks, opens up creative possibilities, and integrates seamlessly with other After Effects tools. Once you master it, you’ll wonder how you ever worked without it.

If you’re just starting with Adobe After Effects or even if you’re a seasoned video editor, wiggle is one of those features that’s endlessly useful. Experiment with it, and you’ll see how much depth and realism it can add to your animations.