Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions if/else condition in 2-dimensional parameters (size)?

  • if/else condition in 2-dimensional parameters (size)?

  • Las Wen

    September 16, 2021 at 11:39 am

    ahoi,

    im am learning since some weeks a little bit expressions and i came to the point to understand and use if/else conditions. Now i was trying to put an if/els into the size of an square shape layer.

    I wrote this:

    if((SizeX = thisComp.width) < 1000) {
    SizeX / 2
    }else{
    SizeX
    };
    var SizeY = thisComp.height;
    [SizeX,SizeY]

    no errors, but its not working 🙁

    if i put this into an expression slider for each dimension and connect them to the shape layer it works…

    if((SizeX = thisComp.width) < 1000) {
    SizeX / 2
    }else{
    SizeX
    }

    no idea what i did wrong…?

  • praveen kulk

    September 16, 2021 at 12:43 pm

    var SizeY = thisComp.height;

    if((SizeX = thisComp.width) < 1000) {

    SizeX = SizeX / 2

    [SizeX,SizeY]
    }else{

    [SizeX,SizeY]
    };

  • Las Wen

    September 16, 2021 at 2:36 pm

    thanks for your reply

    it works till i resize the comp, but than comes an error: couldn’t turn result into numeric value

  • Pau Amer

    September 17, 2021 at 1:05 am

    What are you trying to achieve exactly? Maybe there’s a different approach for what you’re searching for.

  • Las Wen

    September 19, 2021 at 10:20 pm

    i wanted to achieve that the scale of the shape layer divides to half or a specific value. Kind of a responsive Comp with breakpoints (like in html/css).

Viewing 1 - 5 of 5 posts

Log in to reply.

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