Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Clamping Angle Control expression?

Community Beginner ,
Aug 18, 2021 Aug 18, 2021

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

 

TOPICS
Expressions

Views

36

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Aug 18, 2021 Aug 18, 2021

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

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Thanks so much!!

Likes

Translate

Translate

Report

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

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?

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Aug 18, 2021 Aug 18, 2021

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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