Wiggle

wiggle(freq,amp)

wiggle(2,10)

 

The wiggle expression is likely the most used expression in After Effects - at least it is for me, anyway!

It’s a simple expression that creates natural and continuous movement without the use any keyframes.

So what exactly is the wiggle expression?

It’s a simple one-line piece of code that can be applied to any property on your layer of choice; position, rotation, scale, opacity or anywhere else you find a use for it.

Your chosen properties value will then ‘wiggle’ depending on the two numbers you include within the brackets.

Let’s use position as an example:

  1. Whilst holding option on a mac, or ALT on a PC, click the stopwatch next to your desired property

  2. Type wiggle(

  3. Enter your first number, which is the frequency in which the wiggle occurs, followed by a comma (,)

  4. Now enter a second number, which is the amplitude of the wiggle.

  5. The expression may have automatically added the final bracket, but add this at the end if not )

  6. An example expression looks like this: wiggle(2,10)

    Frequency

    As mentioned previously, the first number is the frequency, but what is the frequency?

    This is the amount of times the value changes per second. If you input ‘1’, then the value will change once per second. If you input ‘2’ then the value will change twice per second, and so on.

    Below is an example that is affecting the x position. From top to bottom, the only difference is the frequency, which is going up in 0.5s. The expression at the top is wiggle(0.5,100), then wiggle(1,100), then (wiggle(1.5,100) and so on until we get to very bottom, where the expression is wiggle(3.5,100).

    As you can see in the example, the further down we go, the faster the x position changes.

Amplitude

The second number is the amplitude, or the amount the properties value will change above and below it’s set value.

For example, if the opacity is on 50% and you input the expression wiggle(1,10), then the value of the opacity will randomly change by 10 in either direction.

This means our opacity will wiggle between the values of 40 (50 - 10) and 60 (50 + 10).

The example below shows the same expression on the y position of the dots, with the only difference being the amplitude of the wiggle expression.

Each expression changes value twice per second, with the amplitude increasing from left to right.

Far left expression wiggle(2,5), and the far right expression wiggle(2,50).

You will see that the rate at which the position wiggles stays the same, but the further right we look, the greater the dots random value will be, and therefore the further it will travel.

Wiggle Scale

w = wiggle(freq,amp)

wiggle(w[0],w[0])

You might have noticed that if you input the wiggle expression on a property with two values, for example position (x,y) and scale (s,s), that the wiggle effects both values independently.

This is all okay if this is the desired outcome you are looking for, and this works well on the position, but it creates an odd effect on the scale and other properties where you need both values to be the same.

To keep the properties uniform for the two values, we simply need to adjust the expression slightly.

w = wiggle(2,10);

[w[0],w[0]]

The two numbers on the first line can be altered just like on the normal expression.

Wiggle x or y Position

w = wiggle(freq,amp)

[value[0],w[0]]

The expression in the previous example (scale), will not work if you apply it to the position. It will instead cause both the x and y position to be uniform, meaning the object or layer will simply move in diagonals.

If we wanted just one of our positional values to wiggle, but not the other, this is an easy fix!

On the second line, we need to change one of the ‘w’s to ‘value’. By inputting ‘value’ we ask the expression to refer to the original value set on the property.

If we change the first ‘w’ (which is the x position) the expression will look like this:

w = wiggle(2,10);

[value[0],w[0]]

However if we change the second ‘w’ (which is the y position) the expression will look like this:

w = wiggle(2,10);

[w[0],value[1]]

Note that we also had the change the ‘0’ within the second set of square brackets to a ‘1’. This is because [0] refers to the first property, in this case x position, and [1] refers to the second property, in this case y position.

Next
Next

Time