Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions || operator not working

  • || operator not working

    Posted by David Cabestany on August 23, 2017 at 12:27 am

    Even though the expression below is not broken and is partially working (the x part of it works as expected) the y part is completely ignored regardless of the condition being met.

    Can anyone help me understand why the effect doesn’t increase its value when y is less than 810?

    Thanks.

    x=thisComp.layer("NULL CONTROL").effect("XrotSpd")("Slider");
    y=thisComp.layer("NULL CONTROL").effect("YrotSpd")("Slider");

    if
    (x<1237
    ||
    y<810)
    {

    linear(x,0,1237,0,100);
    }
    else
    0
    ;

    Dan Ebberts replied 8 years, 12 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    August 23, 2017 at 10:21 pm

    I think it works as I would expect. The only time the y clause will even be checked is when x is greater than (or equal to) 1237. And with x that large, the result of linear() will be pegged at 100.

    Dan

  • David Cabestany

    August 25, 2017 at 3:12 pm

    Thanks Dan.

    Any way to have y checked so the effect goes off at y values?

  • Dan Ebberts

    August 25, 2017 at 3:50 pm

    How exactly do you want it to work? (It’s not obvious from your expression.)

    Dan

  • David Cabestany

    August 25, 2017 at 4:09 pm

    A cube flies in rotating with each panel separated.

    Throughout the comp it will rotate three times over x, but the first rotation happens over y. I added an rgb split separation that only happens when the cube is rotating, so I linked it to the speed of the rotations (variables x and y).

    The expected result was to have the value of the rgb split to increase linearly only when the speed was below x’s and y’s peak, but it only worked when x peaked, it disregarded y (for the reason you explained above).

  • Dan Ebberts

    August 25, 2017 at 4:25 pm

    I guess maybe like this (not tested):


    x=thisComp.layer("NULL CONTROL").effect("XrotSpd")("Slider");
    y=thisComp.layer("NULL CONTROL").effect("YrotSpd")("Slider");

    if ( x< 1237){
    linear(x,0,1237,0,100);
    }else if (y < 810){
    linear(y,0,810,0,100);
    }else{
    0;
    }

    Dan

  • David Cabestany

    August 25, 2017 at 4:39 pm

    Didn’t work.
    Thanks anyway man.

  • Dan Ebberts

    August 25, 2017 at 6:11 pm

    It might be that you haven’t defined all the states. What should happen if both x and y are less than their limits? Just x? Just y? Neither?

    Dan

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