wiggle() is a very handy tool indeed, but sometimes you wish you had a little more control over it. In this case, we want to restrict the wiggling to the horizontal direction only.

One of the most important things to understand about wiggle() is that the result it generates has the same dimensions as the property to which it's applied. For example, if you apply wiggle() to the position property of a 3D layer, the result will be an array of three elements (one each for x, y, and z). So, all we need to do is capture the result of wiggle() into a variable (we'll call ours "w") and from that variable we'll extract just the dimension we want to wiggle and combine it with the un-wiggled value(s) of the other dimension(s).

It takes longer to describe than it does to write the code! Here's the code:


w = wiggle(2,50);
[w[0],value[1]]

The effect of wiggle() has been limited to the horizontal direction only.

In an expression, value represents the pre-expression value of the property. For a multi-dimension property, such as Position, value will be an array.

Instead of using value you can use the property's name (position in this case), but using value can make the expression more portable between different properties.