Activity › Forums › Adobe After Effects Expressions › setting a maximum value with IF ELSE in the property to be edited
-
setting a maximum value with IF ELSE in the property to be edited
-
Adam Greenberg
June 1, 2016 at 1:42 pmHI everyone, I have a control layer that drives many other layers. I want to add an expression to the scale of this layer so that it is impossible to go above 100. Is this possible, writing the expression to the property itself rather than using another slider ? I am thinking something like
if(transform.scale.value<100)value else 100
but of coarse that doesn’t work.
Thanks
-
Adam Greenberg
June 1, 2016 at 2:34 pmthrough googling and googling, I have a found a work around, but I would still like to know how write the expression I originally thought of. In the meantime, see below for anyone who may need this in the future.
sclamp=clamp(transform.scale[0],0,100);
[sclamp,sclamp]basically returns any value between 0 and 100 even if you try to go below 0 or above 100.
-
Dan Ebberts
June 1, 2016 at 4:08 pmThis would be another way:
[Math.min(value[0],100),Math.min(value[1],100)]
Dan
Reply to this Discussion! Login or Sign Up
Log in to reply.