ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# || operator not working

FAQ   •   VIEW ALL
 || operator not working on Aug 23, 2017 at 12:27:40 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&lt;1237 || y&lt;810) { linear(x,0,1237,0,100); } else 0 ;```

 Re: || operator not workingon Aug 23, 2017 at 10:21:19 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

 Re: || operator not workingon Aug 25, 2017 at 3:12:43 pm

Thanks Dan.

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

 Re: || operator not workingon Aug 25, 2017 at 3:50:27 pm

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

Dan

 Re: || operator not workingon Aug 25, 2017 at 4:09:55 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).

 Re: || operator not workingon Aug 25, 2017 at 4:25:28 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

 Re: || operator not workingon Aug 25, 2017 at 4:39:11 pm

Didn't work.
Thanks anyway man.