Skip to main content
Participating Frequently
August 18, 2021
Question

Clamping Angle Control expression?

  • August 18, 2021
  • 2 replies
  • 408 views

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

 

This topic has been closed for replies.

2 replies

Mylenium
Legend
August 18, 2021

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

Mylenium
Legend
August 18, 2021

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

Participating Frequently
August 18, 2021

Thanks so much!!