Expression Library

# Wiggle Expression Variations

Wiggle is one of the most commonly used and referenced After Effects expressions, given its wide applicability. Beyond the basic wiggle effect (which defines bounds for amplitude and frequency), there are a number of fun variations on this basic expression which are worth checking out. The code interface below includes expressions for Looping Wiggle, Y-only Wiggle, X-only Wiggle, and clamped wiggle.

## Code Samples

Hover over the code and click the copy button.

## Loop

A wiggle that loops back to its start position after a specified time.

```				```
freq = 1;
amp = 110;
loopTime = 3;
t = time % loopTime;
wiggle1 = wiggle(freq, amp, 1, 0.5, t);
wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime);
linear(t, 0, loopTime, wiggle1, wiggle2)
```
```

## X-axis only

A wiggle that only moves from side to side.

```				```
w = wiggle(2,50); // or change to whatever rate and amplitude you want.
[w[0], value[1]]
```
```

## X-axis only

A wiggle that moves up and down.

```				```
w = wiggle(2,50); // or change to whatever rate and amplitude you want.
[value[0], w[1]]
```
```

## Clamped Wiggle

Uses a clamp expression to set a “floor”. Replace the w2 function with line 2 from the Horizontal Wiggle above to set a “wall” for the wiggle. The gif below demonstrates the “floor” clamped wiggle.

```				```
w1 = wiggle(5,100)- value;
w2 = [value[0], w1[1]];
w3 = clamp(w2,[-100,-100],[100,0])
value + w3
```
```