Copy link to clipboard
Copied
Hi All,
I have a 3D layer with its y rotation being controlled via an adjustment layer with an angle control effect and wiggle expression for random rotation. Works OK for the most part but I would like to clamp the output value so the wiggles stay within 0-85 degrees. Is this possible at all?
I tried something I found online but it returns a "must be of dimension 1, not 2" error.
rClamp=clamp(effect("Angle Control")("Angle"),0,85);
[effect("Angle Control")("Angle"),rClamp];
Thank you!
Ken
Copy link to clipboard
Copied
You have the answer right there - no need to include the effect reference in the final statement. Variables are the value, not a statement/ parameter to the value. Just writing rClamp as the last line will do fine for this 1D property.
Mylenium
Copy link to clipboard
Copied
Thanks so much!!
Copy link to clipboard
Copied
Might be doing something wrong here but I adjust the code and when I manually rotate the layer it stays clamped but when I add a wiggle to the next line it seems to disregard the clamp and still goes outside of the set values?
Copy link to clipboard
Copied
wiggle()is additive and is applied on top of any previous value. You need to clamp the wiggle output itself:
rWig=wiggle(5,7);
rClamp=clamp(value+wiggle,0,85)
For smoother transitions you may also want to consider remapping values via a linear() function rather than a hard clamp.
Mylenium