Sure,
w1 = wiggle(5,40) – value;
w2 = clamp(w1,[-40,-40],[40,0])
value + w2
The first line is used to isolate the wiggle from the property’s (Position in this case) value. For example, if you have an object located at [100,100],
wiggle(5,40)
will give you values that range from [60,60] to [140,140]. These values are centered around [100,100]. By subtracing “value” (which is just shorthand for “the pre-expression value of this property” = the same as “position” in this case), you isolate the wiggle component and the result ranges between [-40,-40] and [40,40] (centered around [0,0]), which is what we need for the next step. The clamp function just clamps the first parameter so that it lies between the second an third parameters. In this case, it’g going to clamp our wiggle value between [-40,-40] and [40,0]. So what we have done here is replace all positive y values (which represents downward movement in the AE coordinate system) with 0’s.
value + w2
just adds the clamped wiggle component back onto the non-expression position value.
In the second expression:
w = wiggle(5,40) – value;
value + [w[0],-Math.abs(w[1])
We’re again isolating the wiggle component. The -Math.abs(w[1]) just ensures that any positive y wiggle value gets converted to a negative value (negative values will remain negative). This just reflects any downward wiggle to upward wiggle.
You’re correct that if it were 3D we’d have to deal with x,y, and z.
Assuming your wiggling layer is named “Layer 1” these expressions for your shadow layer should get you headed in the right direction:
// mask expansion
minExpansion = 0;
maxExpansion = 25;
layer1RestPos = [320,240];
delta = thisComp.layer(“Layer 1”).position – layer1RestPos;
linear(delta[1],-40,0,maxExpansion,minExpansion);
// mask feather
minFeather = 0;
maxFeather = 25;
layer1RestPos = [320,240];
delta = thisComp.layer(“Layer 1”).position – layer1RestPos;
f = linear(delta[1],-40,0,maxFeather,minFeather);
[f,f]
//position
layer1RestPos = [320,240];
delta = thisComp.layer(“Layer 1”).position – layer1RestPos;
value + delta[0]
Dan