Mastering the Wiggle Expression in After Effects: A Beginner's Guide

|
21 mins
|
Apr 15, 2025

- First Off: What Exactly is this Wiggle Thing?
- A Little More Control (Optional Advanced Parameters)
- Wiggle on One Dimension Only (X, Y, or Z)
- Making Your Wiggle Loop Seamlessly
- A Few Extra Tips and Tricks
- Frequently Asked QuestionsWhat is the wiggle expression in After Effects and how do I use it?How can I make the wiggle expression loop seamlessly in After Effects?Can I use the wiggle expression on properties other than Position, like Scale, Rotation, or Opacity?How do I make a layer wiggle only on the X-axis (horizontally) or Y-axis (vertically)?What are the main parameters (like frequency and amplitude) for the wiggle expression, and what does the basic code look like?How do I control the speed and intensity of the wiggle?Can I make the wiggle stay between two specific values?How can I stop the wiggle effect at a certain point in time?Is there a 'wiggle bounce' expression?
- Wrapping Up: Go Forth and Wiggle!
- Spotlight FX - Get free transitions, effects and workflow tools
Hey there! So, you're starting out with Adobe After Effects, or maybe you've been using it for a bit but keep hearing about this thing called the "Wiggle" expression? You've come to the right place! Wiggle is one of those super useful tools in After Effects that can add some really nice, organic-looking movement to your layers without you having to manually keyframe every little shake and bump. Think shaky camera effects, flickering lights, subtle random motion on text or objects, that sort of thing.
It sounds fancy, maybe a little intimidating because it involves a tiny bit of code (don't worry, it's easier than it looks!), but honestly, once you get the hang of it, you'll probably find yourself using it all the time.
My goal here is to walk you through it, kind of like how I'd explain it to a friend just starting out. We'll cover the basics, then get into some neat tricks like making things wiggle only side-to-side or up-and-down, and even how to make your wiggle animation loop perfectly, which is super handy for GIFs or repeating backgrounds. Let's get started!
First Off: What Exactly is this Wiggle Thing?
Alright, before we jump straight into wiggle(), let's quickly talk about "Expressions" in After Effects. Basically, expressions are little snippets of code, usually JavaScript, that you can apply to layer properties (like Position, Scale, Rotation, Opacity, etc.). Instead of setting keyframes manually to tell something how to move or change over time, you can use an expression to tell After Effects how to calculate the value for that property on every single frame automatically. It's like giving instructions instead of drawing the whole map.
The wiggle() expression is probably the most famous and commonly used one. Its job is simple: make things wiggle! It generates random variations around the property's original value.
The Basic Wiggle Syntax: wiggle(freq, amp)
Okay, let's get to the actual expression. The most basic form of wiggle looks like this:
1wiggle(freq, amp)
You'll type this into the expression field for a property. How do you get there?
- Find the layer you want to wiggle in your timeline.
- Twirl down the little arrow next to the layer name, then twirl down 'Transform' (or Effects, or Text, depending on what you want to wiggle).
- Find the property you want to animate, let's say 'Position'.
- Hold down the Alt key (on Windows) or the key (on Mac) and click the little stopwatch icon next to the property name (Position, in this case).
- The numbers for that property turn red, and a text field appears in the timeline where the keyframes usually go. This is the expression editor! You'll probably see some default text like transform.position already in there. Just delete that and type in your wiggle expression.
So, what do freq and amp mean?
- freq (Frequency): This number tells After Effects how often you want the wiggle to happen per second. Think of it like speed or rate. A frequency of 1 means it will try to complete roughly one wiggle cycle every second. A frequency of 5 means it'll wiggle much faster, about five times per second. Imagine tapping your foot, frequency is how many taps per second.
- amp (Amplitude): This number controls how much the property value changes, basically the intensity or strength of the wiggle. If you're wiggling Position, an amplitude of 50 means the layer might move up to 50 pixels away from its original spot (in any direction, randomly). If you're wiggling Rotation, an amplitude of 10 means it might rotate up to 10 degrees back and forth. Think of it like how far your foot moves when you tap it.
Let's Try a Simple Example!
- Create a new composition (CTRL+N or +N). Maybe 1920x1080, a few seconds long.
- Create a new solid layer (Layer > New > Solid, or CTRL+Y / +Y). Pick any color. Make it smaller than the comp, maybe 200x200 pixels, so you can see it move.
- With the solid layer selected, press P on your keyboard to reveal its Position property.
- Hold ALT (Win) or (Mac) and click the stopwatch next to 'Position'.
- Delete the default text (transform.position) and type this in: wiggle(2, 50)
- Click anywhere outside the text field to apply the expression.
- Now, press the spacebar to preview your animation.
See that? The solid layer is randomly moving around its center point! It's doing this roughly twice per second (freq = 2) and moving up to about 50 pixels away from its starting position (amp = 50) on both the X (horizontal) and Y (vertical) axes.
Go ahead and experiment! Click back into the expression field and change the numbers.
- Try wiggle(10, 50) - Much faster, more jittery movement!
- Try wiggle(2, 200) - Same speed as the first one, but much larger movements.
- Try wiggle(0.5, 10) - Very slow, subtle drift.
Playing with these two numbers is key. Don't worry about breaking anything, you can always delete the expression or just type value into the expression field to get the original static value back. Getting a feel for how frequency and amplitude interact is the first big step.
Wiggling More Than Just Position
The cool thing is, you can apply wiggle() to almost any property with numerical values!
- Scale: Select your layer, press S for Scale. Alt or click the stopwatch. Try wiggle(1, 10). Your layer will now randomly pulse in size, growing and shrinking by up to 10% (since scale is percentage based). It affects both X and Y scale together by default.
- Rotation: Press 'R' for Rotation. Alt or click the stopwatch. Try wiggle(3, 15). The layer will randomly rotate back and forth, up to 15 degrees, about three times per second.
- Opacity: Press 'T' for Opacity (T for Transparency, makes sense, right?). Alt or click. Try wiggle(5, 25). The layer will flicker, its opacity randomly changing by up to 25% around its current value (which is usually 100% unless you changed it). You might notice it sometimes tries to go above 100% or below 0%. After Effects usually clamps this automatically for Opacity, keeping it between 0 and 100, which is helpful! For other properties, wiggling could potentially produce weird results if not careful (like negative scale flipping the layer), but for basic wiggle, it's usually fine.
Mixing these can create some complex-looking natural motion. Imagine wiggling position slightly and rotation slightly on a graphic to make it feel like it's floating gently.
A Little More Control (Optional Advanced Parameters)
The basic wiggle(freq, amp) works great most of the time. But there are actually a few more parameters you can add for finer control, though honestly, I don't use them nearly as often. The full wiggle syntax looks more like this:
1wiggle(freq, amp, octaves = 1, amp_mult = 0.5, time = time)
- octaves: This adds layers of detail to the wiggle. Think of it like the main wiggle is a big wave, and octaves add smaller, faster ripples on top of that wave. The default is 1 (just the main wiggle). Increasing it (like 3 or 5) makes the motion more complex and 'noisy'. Try wiggle(1, 50, 5) on position and compare it to wiggle(1, 50). See the extra little jiggles?
- amp_mult (Amplitude Multiplier): This controls how much the amplitude of each octave contributes to the overall wiggle, relative to the previous one. The default is 0.5, meaning each added octave has half the amplitude of the one before it. Lowering it (like 0.2) makes the extra details fainter; increasing it makes them stronger.
- time: This lets you base the wiggle calculation on a different time value than the current composition time. This is more advanced, used for things like making wiggle speed up or slow down based on other factors, or for the looping techniques we'll discuss later. You usually don't need to touch this for standard wiggles.
Honestly? Stick with freq and amp for now. Get comfortable with those first. The other parameters are there if you find yourself needing really specific, complex noise patterns, but they're not essential for beginners.
Wiggle on One Dimension Only (X, Y, or Z)
Okay, this is a super common need. You've applied wiggle(2, 50) to the position, and your layer is bouncing all over the place, horizontally and vertically. But what if you only want it to shake side-to-side (X-axis)? Or maybe just bob up and down (Y-axis)? The default wiggle hits all dimensions of a property at once. For Position in 2D, that's X and Y. For Position in 3D, it's X, Y, and Z. Same for Scale (X, Y, Z).
Luckily, there are ways to restrict the wiggle!
Method 1: The Easy Way for Position (Separate Dimensions)
After Effects has a built-in feature specifically for this with the Position property. It's super handy!
- Select your layer.
- Find the 'Position' property under Transform.
- Right-click directly on the word "Position".
- In the menu that pops up, choose "Separate Dimensions".
- Voilà! Instead of one 'Position' property, you'll now see 'X Position', 'Y Position', and if your layer was 3D, 'Z Position', each listed separately with its own stopwatch.
Now, you can apply wiggle to just one of them!
- To wiggle only horizontally (X-axis): Alt or click the stopwatch next to 'X Position' and type your wiggle(freq, amp), like wiggle(3, 40). Leave the Y Position (and Z Position) alone (don't even enable expressions on them).
- To wiggle only vertically (Y-axis): Alt or click the stopwatch next to 'Y Position' and type your wiggle expression there. Leave X alone.
- To wiggle only in depth (Z-axis, requires the layer to be 3D): Make sure the layer's 3D switch is checked in the timeline. Then Alt or click the stopwatch for 'Z Position' and add your wiggle there.
This is often the quickest and cleanest way to handle 1D wiggle for position. Easy peasy.
Method 2: Using Expression Code (More Flexible, Works for Other Properties)
The "Separate Dimensions" trick is great, but it only works for Position. What if you want Scale to wiggle only horizontally? Or you want more complex control? Then we need to dip our toes a little deeper into expression code. Don't panic! It's logical once you break it down.
The core idea is:
- Figure out the layer's current value for the property.
- Calculate the wiggle amount separately.
- Create a new value where you combine parts of the original value with parts of the wiggle value.
Properties like Position and Scale are stored internally as arrays of numbers. An array is just a list of values.
- For 2D Position/Scale: It's an array like [X value, Y value]
- For 3D Position/Scale: It's an array like [X value, Y value, Z value]
In expressions, you can access individual parts of an array using square brackets []. The first item is index [0], the second is [1], the third is [2], and so on (programmers like to start counting from zero!).
So, for a position property value, value[0] is the X coordinate, and value[1] is the Y coordinate.
Let's make the layer wiggle ONLY on the X-axis using expressions:
- Select your layer, reveal the Position property (press 'P').
- Make sure "Separate Dimensions" is off (if you turned it on, right-click Position again and uncheck it). We want the single Position property.
- Alt or click the Position stopwatch.
- Enter this code:
1JavaScript2var freq = 2; // How often per second3var amp = 50; // How many pixels45// Calculate the wiggle. This still calculates for both X and Y internally.6var w = wiggle(freq, amp);78// Now, build the final result array:9// We want the wiggled X-value, but the original Y-value.10// w[0] is the calculated wiggle's X component.11// value[1] is the layer's original, current Y component.12[w[0], value[1]];
Let's break that down:
- var freq = 2; and var amp = 50;: We're using variables (little containers for storing values) to make it easy to change the frequency and amplitude at the top. var just declares a variable.
- var w = wiggle(freq, amp);: We run the wiggle function using our variables and store the resulting random [x, y] array in a variable called w.
- [w[0], value[1]];: This is the final line, which determines the property's value. We're creating a new 2-element array.
- For the first element (X), we take w[0], which is the X part of the calculated wiggle result.
- For the second element (Y), we take value[1], which refers back to the original Y value of the Position property before the expression was applied on this frame. This effectively keeps the Y position unchanged.
If you apply this, your layer will only shake left and right!
Want to wiggle only on the Y-axis? Just swap the last line:
1var freq = 2;2var amp = 50;34var w = wiggle(freq, amp);56// Keep original X, use wiggled Y7[value[0], w[1]];
See the change? Now we use the original X (value[0]) and the wiggled Y (w[1]).
And for Z-axis only (on a 3D layer)? Remember, 3D properties have 3 values: [X, Y, Z], which correspond to indices [0], [1], and [2].
- Make your layer 3D (check the little cube icon for the layer in the timeline).
- Altor click the Position stopwatch.
- Enter this:
1var freq = 2;2var amp = 50;34// Make sure the layer is 3D!5var w = wiggle(freq, amp); // Wiggle calculates [x, y, z] for 3D layers67// Keep original X, keep original Y, use wiggled Z8[value[0], value[1], w[2]];
Now it only moves back and forth in depth.
This expression method seems more complicated at first, I know. But look - you can now apply this logic to Scale too! Just apply the same kind of expression to the Scale property. For example, to make something wiggle its width only:
1var freq = 1;2var amp = 10; // Wiggle scale by 10%34var w = wiggle(freq, amp);56// Use wiggled X scale (width), keep original Y scale (height)7// Assuming it's a 2D layer scale [width, height]8[w[0], value[1]];
So, Method 1 (Separate Dimensions) is great and easy for Position. Method 2 (Expression Code) is more powerful because it works on other properties and gives you a foundation for even more complex expression magic later on. Pick whichever feels more comfortable for what you're doing! You know, start simple, and add complexity when you need it.
Making Your Wiggle Loop Seamlessly
Alright, here's another common challenge. You've got this cool wiggle animation, maybe on a background element or a character, and you want it to repeat perfectly. If you just let a standard wiggle() run, it's random forever. When the timeline loops back to the beginning, the position or rotation will suddenly jump because the random value at the end of the loop won't match the value at the start. Annoying, right? Especially for GIFs or looping video backgrounds.
We need a way to make the wiggle end exactly where it started, and preferably with the same speed or velocity too, so it looks completely smooth.
There are a few ways to approach this, some simpler but maybe less perfect, and one standard technique that's a bit more complex but generally gives the best results.
The Core Idea: Controlling Randomness and Blending
The wiggle function uses a pseudo-random number generator. We need to make sure that the sequence of random numbers it generates over our desired loop duration starts and ends in a way that they connect smoothly. The key is usually manipulating the random seed (the starting point for the random sequence) and sometimes blending calculations over time.
How to Loop Wiggle
There's a well-known technique, often credited to motion graphics guru Dan Ebberts, that handles looping wiggle much more reliably by ensuring both the value and the velocity match at the loop point. It looks a bit more intimidating, but it's actually quite clever.
The core idea is to calculate the wiggle twice: once for the current time within the loop cycle, and once for what the wiggle would have been exactly one loop duration earlier. Then, you smoothly blend between these two calculations over the course of the loop. Because the underlying random pattern is made consistent using seedRandom, the end point of the "past" calculation perfectly matches the start point of the "current" calculation.
Here's the "copy and paste" code.
1var freq = 1; // Wiggles per second2var amp = 100; // Wiggle amount (pixels, degrees, percent, etc.)3var loopTime = 5; // IMPORTANT: Set this to your exact loop duration in seconds!4// For example, if your comp is 5 seconds long and loops, use 5.56// --- The Magic Loop Code Starts Here ---78var t = time % loopTime; // Time within the current loop cycle (0 to loopTime)910// Calculate wiggle at time 't' within the loop11// seedRandom needs to be consistent for the loop. Using layer index is common.12// 'timeless = true' makes the random sequence depend only on the seed, not time itself.13seedRandom(index, true);14var wiggle1 = wiggle(freq, amp, 1, 0.5, t); // Use 't' as the time basis1516// Calculate wiggle at time 't - loopTime'. This effectively looks back one full cycle.17seedRandom(index, true); // Use the SAME seed again! Crucial.18var wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime); // Use 't - loopTime' as the time basis1920// Blend between the 'past' wiggle (wiggle2) and the 'current' wiggle (wiggle1)21// As 't' goes from 0 to loopTime, this smoothly transitions from wiggle2's end state22// to wiggle1's end state, which are designed to match wiggle1's start state and23// wiggle2's start state respectively due to the seeding.24linear(t, 0, loopTime, wiggle2, wiggle1);
Let's try to unpack that:
- freq, amp, loopTime: Set these at the top to control your wiggle and match your desired loop duration. loopTime is critical – make sure it matches how long your loop actually is!
- t = time % loopTime;: This uses the modulo operator (%) to figure out where we are within the current loop cycle. If loopTime is 5, t will go 0, 0.1, 0.2... up to 4.99, then wrap back to 0 as time crosses 5 seconds.
- seedRandom(index, true);: This is super important. seedRandom sets the starting point for the random number generator.
- index uses the layer's number in the timeline stack as the seed. This means if you duplicate the layer, the duplicate will have a different wiggle pattern (since its index is different), which is usually what you want.
- true makes the seed timeless. This means the random sequence generated by wiggle() will only depend on the seed (index) and the time value we feed into it later. It ensures the pattern repeats predictably cycle after cycle. - var wiggle1 = wiggle(freq, amp, 1, 0.5, t);: This calculates the wiggle, but instead of using the global time, it uses t (our time within the loop). So, this represents the wiggle's state progressing through the current loop cycle.
- seedRandom(index, true);: We set the exact same seed again. This is essential.
- var wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime);: This calculates the wiggle again, but using a time value that's exactly one loop duration before t. This represents the state of the wiggle in the previous loop cycle.
- linear(t, 0, loopTime, wiggle2, wiggle1);: This is the blending part. The linear() function here acts as an interpolator. It says: "As t goes from 0 to loopTime, smoothly transition the output value from whatever wiggle2 calculates to whatever wiggle1 calculates." Because wiggle2 at the end of its cycle (t = loopTime) matches wiggle1 at the beginning of its cycle (t = 0) thanks to the consistent seeding, this blend creates a seamless handover.
Phew! That's definitely the most complex bit we've covered, but it's the standard way to get really smooth wiggle loops. Copy it, paste it, adjust the top three variables, and it should just work! Test it by previewing across the loop point (the end of your loopTime) or rendering out two cycles back-to-back. You shouldn't see any jump. It feels a bit like mathematical wizardry the first time, but it’s incredibly useful.
A Few Extra Tips and Tricks
Okay, you've got the basics, 1D wiggles, and looping down. Here are a couple more things that can make working with wiggle even better:
Use Slider Controls for Easy Tweaking: Digging into the expression code every time you want to change the frequency or amplitude can be a bit tedious. A much nicer workflow is to use Expression Controls!
- Select the layer you want to wiggle (or create a Null Object if you want to control wiggle for multiple layers at once – Layer > New > Null Object).
- With the layer/null selected, go to the menu: Effect > Expression Controls > Slider Control.
- In the Effects Controls panel, you'll see the slider. Rename it (select it, press Enter) to something like "Wiggle Frequency".
- Add another Slider Control (Effect > Expression Controls > Slider Control again). Rename this one "Wiggle Amplitude".
- Now, go to your wiggle expression (e.g., on Position). Instead of typing numbers for freq and amp, delete the numbers and use the little 'pick whip' icon (looks like a spiral/swirl) next to freq or amp in your code. Drag the pick whip from the code up to the slider value for "Wiggle Frequency" in the Effect Controls panel. Let go. After Effects will write the link for you (it'll look something like effect("Wiggle Frequency")("Slider")).
- Do the same for amplitude: delete the number, drag the pick whip from the code to the "Wiggle Amplitude" slider's value.
- Your expression might now look something like this:
1var freq = effect("Wiggle Frequency")("Slider");2var amp = effect("Wiggle Amplitude")("Slider");3wiggle(freq, amp);
Now, you can just adjust the sliders in the Effect Controls panel! It's way faster to experiment and fine-tune the look without ever opening the expression editor again. You can even keyframe the sliders to make the wiggle change intensity over time! If you used a Null object, you can link multiple layers' wiggles to the same sliders on the Null for consistent control. Super useful.
Performance Considerations: Wiggle is calculated on every single frame. If you have tons of layers with complex wiggles, it can start to slow down your After Effects previews and renders. If things get sluggish:
- You can temporarily disable expressions using the little = switch next to the property's stopwatch. Turn it off (=/) to see the layer without the wiggle, turn it back on (=) to re-enable.
- For final renders, if the wiggle is finalized and you don't need to tweak it anymore, you can "bake" the expression into keyframes. Select the property, go to Animation > Keyframe Assistant > Convert Expression to Keyframes. After Effects will analyze the expression and place a keyframe on every single frame with the calculated value. The expression will be gone, replaced by tons of keyframes. The animation will look identical, but AE doesn't have to calculate it anymore, which can speed things up. The downside? You lose the flexibility to easily change the wiggle later. Use it only when needed.
- Subtlety is Often Better: It's easy to go wild with huge amp values when you first discover wiggle. Sometimes that's fun! But often, a very subtle wiggle (freq of 0.5 or 1, amp of just 5 or 10 pixels for position, or 1-2 degrees for rotation) adds a lovely touch of life and organic feel without being distracting. Don't underestimate small values!
Adding Wiggle to Existing Animation:
Want something to follow a path you keyframed, but also have a little random shake on top? Easy! Just add the wiggle to the existing keyframed value. Instead of replacing your animation with just wiggle(freq, amp), you can often use this simple structure to add wiggle on top of it:
1// Add wiggle directly to keyframed value2var freq = 1; // Wiggle speed3var amp = 15; // Wiggle intensity4value + wiggle(freq, amp);
The value keyword here automatically represents the property's value based on your keyframes at the current time. This expression takes that keyframed animation and adds the random wiggle offset directly.
Frequently Asked Questions
You made it through the main guide, awesome! Sometimes specific questions pop up, so I gathered some common ones based on what people often search for when learning about wiggle. Hopefully, these quick answers help clear things up even more!
What is the wiggle expression in After Effects and how do I use it?
Wiggle is an After Effects expression using wiggle(freq, amp) to add random movement to properties. Apply it by Alt or clicking a property's stopwatch and typing the code, replacing freq (speed, wiggles/sec) and amp (intensity/amount).
For example:
1wiggle(2, 30)
How can I make the wiggle expression loop seamlessly in After Effects?
To make wiggle loop seamlessly, use this expression, adjusting freq, amp, and loopTime (your loop duration in seconds) at the top.
1var freq = 1; // Wiggles per second2var amp = 100; // Wiggle amount3var loopTime = 5; // IMPORTANT: Set loop duration here!45// --- Loop Code ---6var t = time % loopTime;7seedRandom(index, true);8var wiggle1 = wiggle(freq, amp, 1, 0.5, t);9seedRandom(index, true);10var wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime);11linear(t, 0, loopTime, wiggle2, wiggle1);
Can I use the wiggle expression on properties other than Position, like Scale, Rotation, or Opacity?
Yes, apply wiggle(freq, amp) to Scale, Rotation, Opacity, or other numerical properties (even for effects) just like Position by Alt or clicking their stopwatch.
How do I make a layer wiggle only on the X-axis (horizontally) or Y-axis (vertically)?
For Position only:
- Right-click Position
- Separate Dimensions
- then apply wiggle to only X or Y.
For other properties or more control, modify the expression array.
For X-only use:
1// Wiggle only on X axis2freq = 3; // wiggles per second3amp = 50; // wiggle amount in pixels45w = wiggle(freq, amp);6[w[0], value[1]] // wiggle X, keep Y unchanged
For Y-only use:
1// Wiggle only on Y axis2freq = 3; // wiggles per second3amp = 50; // wiggle amount in pixels45w = wiggle(freq, amp);6[value[0], w[1]] // keep X steady, wiggle Y
For Z-only, use:
1freq = 3; // wiggles per second2amp = 50; // wiggle amount in pixels34w = wiggle(freq, amp);5[value[0], value[1], w[2]] // X and Y stay fixed, wiggle Z
What are the main parameters (like frequency and amplitude) for the wiggle expression, and what does the basic code look like?
The main parameters are freq (frequency/speed, first number) and amp (amplitude/intensity, second number). Basic code is: wiggle(freq, amp)
1wiggle(2, 30)
How do I control the speed and intensity of the wiggle?
Control speed with freq (first number: lower=slower, higher=faster).
Control intensity/amount with amp (second number: lower=subtle, higher=intense).
1wiggle(2, 50)2// This example has: frequency = 2 (moderate speed), amplitude = 50 (moderate intensity)
Can I make the wiggle stay between two specific values?
Yes, by limiting the wiggle's offset from the start value using the clamp() function. Apply this expression to your property (like Position):
1// --- Settings ---2var freq = 5; // Wiggle speed (wiggles per second)3var amp = 100; // Wiggle intensity (max offset if not clamped)4var minOffsetX = -50; // Set Max distance LEFT (negative X offset)5var maxOffsetX = 50; // Set Max distance RIGHT (positive X offset)6var minOffsetY = -50; // Set Max distance UP (negative Y offset)7var maxOffsetY = 50; // Set Max distance DOWN (positive Y offset)8// --- Code ---9value + clamp(wiggle(freq, amp) - value, [minOffsetX, minOffsetY], [maxOffsetX, maxOffsetY]);
Adjust the six variables under // --- Settings --- to control the wiggle and set the specific minimum/maximum offset allowed from the layer's starting position on the X and Y axes. The last line calculates the wiggle offset, clamps it within your limits, and adds it back to the original value.
How can I stop the wiggle effect at a certain point in time?
You have multiple options:
- Keyframing its amp down to 0 (best linked to a Slider Control).
- Baking the expression to keyframes (Animation > Keyframe Assistant > Convert Expression to Keyframes) and deleting keys after the stop time.
- Using an if (time < stopTime) { wiggle(...) } else { value; } structure in the expression.
1// --- Settings ---2var stopTime = 2; // Set the time (in seconds) to stop wiggling3var freq = 5; // Set wiggle speed (before stopTime)4var amp = 100; // Set wiggle intensity (before stopTime)5// --- Code ---6if (time < stopTime) {7 wiggle(freq, amp); // Output wiggle if time is less than stopTime8} else {9 value; // Output the original static value otherwise10}
Change the stopTime variable to the exact second you want the wiggle to end. You can also adjust the freq and amp variables that control the wiggle before it stops. After the stopTime is reached, the expression will simply output the layer's original, non-wiggling value.
Is there a 'wiggle bounce' expression?
There isn't a function called "wiggle bounce". However, if you want your layer to overshoot its final keyframe and bounce back a bit before settling (inertial bounce), you can use an expression like this one. Apply it to the property you've keyframed (e.g., Position):
1// --- Bounce Settings ---2var amp = 0.1; // Amplitude: Controls how much bounce (try 0.1 to 0.3)3var freq = 2.5; // Frequency: Controls the speed of the bounces4var decay = 4.0; // Decay: Controls how quickly the bounces fade out5// --- Expression Code (Usually no need to edit below) ---6var n = 0;7if (numKeys > 0){8 n = nearestKey(time).index;9 if (key(n).time > time) n--;10}11if (n > 0){12 var t = time - key(n).time;13 var velocity = velocityAtTime(key(n).time - thisComp.frameDuration / 2);14 if (value instanceof Array){ // Handles properties like Position, Scale (arrays)15 var bounce = [];16 for (var i = 0; i < value.length; i++){17 bounce[i] = velocity[i] * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t);18 }19 value + bounce;20 } else { // Handles 1D properties like Rotation21 value + velocity * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t);22 }23} else {24 value; // If no previous keyframes, return the static value25}
How to use this:
- Make sure you have at least two keyframes on the property you apply this expression to (e.g., animate position from A to B).
- Apply this expression to that property.
- The bouncing effect will happen after the layer reaches the keyframe(s).
- Adjust the amp, freq, and decay variables at the top to customize how springy or damped the bounce feels.
Remember, this reacts to your keyframes to create the bounce; it's different from the continuous random motion of wiggle().
Wrapping Up: Go Forth and Wiggle!
Okay, that was quite a bit of information, wasn't it? We went from the absolute basics of what wiggle is (wiggle(freq, amp)) and how to apply it, looked at wiggling different properties like scale and rotation, tackled how to make things wiggle only horizontally or vertically using both Separate Dimensions and expression code.
The main thing now is to actually try this stuff out. Open After Effects, make some shapes, and just play around. Apply wiggle, change the numbers, try the 1D expression, copy-paste the loop code and see if it works. Don't be afraid to experiment or make mistakes, that's honestly the best way to learn this stuff. It might feel a little clunky at first, but like I said, once you do it a few times, adding a bit of wiggle here and there will become second nature. It's a fantastic tool for adding that extra bit of dynamic movement and life to your animations.
So yeah, hopefully, this gives you a solid starting point for mastering the wiggle expression. It’s one of those foundational things in After Effects motion graphics that opens up a lot of creative possibilities.
Got questions? Stuck on something? Feel free to reach out or DM me at x.com/DenisStefanides. I’d love to hear what you’re working on. Otherwise, get experimenting and happy wiggling!

Denis Stefanides
About the author