Creative Communities of the World Forums

The peer to peer support community for media production professionals.

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 pm

    HI 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 pm

    through 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 pm

    This would be another way:

    [Math.min(value[0],100),Math.min(value[1],100)]

    Dan

  • Adam Greenberg

    June 2, 2016 at 12:03 pm

    excellent, thanks

Viewing 1 - 4 of 4 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy