Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Clamping Angle Control expression?

Community Beginner ,
Aug 18, 2021 Aug 18, 2021

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

 

TOPICS
Expressions
379
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 18, 2021 Aug 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 18, 2021 Aug 18, 2021

Thanks so much!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 18, 2021 Aug 18, 2021

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 18, 2021 Aug 18, 2021
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines