Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Is there a better way? (if else stuff)

  • Is there a better way? (if else stuff)

    Posted by Griffin Englander on May 26, 2025 at 5:24 am

    Good day my beautiful friends,

    I’m using this expression to essentially up the value of a slider, as soon as a certain layer’s x Scale goes higher than 0.

    I’m keen to see if there’s a more simple, and safer way of writing, or approaching this? In a perfect world I wouldn’t have to add an additional statement if I wanted to check more than 4 layers.

    Thank you in advance for your help!

    var v = 0;
    f = framesToTime(3);
    offset = time+f;

    var L1 = thisComp.layer(“L1”).transform.scale.valueAtTime(offset)[0];
    var L2 = thisComp.layer(“L2”).transform.scale.valueAtTime(offset)[0];
    var L3 = thisComp.layer(“L3”).transform.scale.valueAtTime(offset)[0];
    var L4 = 0;

    if (L1>0 && L2 == 0) {v = 1
    }else if (L2>0 && L3 == 0) {v = 2
    }else if (L3>0 && L4 == 0) {v=3
    }
    else v=1;

    Griffin Englander replied 2 weeks, 6 days ago 2 Members · 2 Replies
  • 2 Replies

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