ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Multiple if/else expressions for one value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nicholas Deines
Multiple if/else expressions for one value
on Jun 2, 2020 at 6:48:21 pm

Is it possible to have multiple if/else expressions for one value?

With the expression code below, the first "if" expression works fine, but the second doesn't do what (I think) I'm asking it to—though I don't get any errors.

if (thisComp.layer("Percentage 2").content("Trim Paths 1").end==0) 0 else 100; if (thisComp.layer("EXTRACT PIECE").effect("3 Extract Z")("Slider")==1-59) 0 else 100;


Return to posts index

Dan Ebberts
Re: Multiple if/else expressions for one value
on Jun 2, 2020 at 7:25:41 pm

You would generally use else if to combine them. I'm not sure if this is the logic you had in mind, but this would be one way to combine them:


if (thisComp.layer("Percentage 2").content("Trim Paths 1").end==0)
0
else if (thisComp.layer("EXTRACT PIECE").effect("3 Extract Z")("Slider")==1-59)
0
else
100;



Dan



Return to posts index

Nicholas Deines
Re: Multiple if/else expressions for one value
on Jun 3, 2020 at 4:05:37 pm

Okay, I didn't know about "else if". Thanks!


Return to posts index


Robert Müller
Re: Multiple if/else expressions for one value
on Jun 3, 2020 at 9:50:53 am

if (thisComp.layer("EXTRACT PIECE").effect("3 Extract Z")("Slider")==1-59) 0 else 100;
Just for my understanding, do you want your condition be true if the slider has the value 1 minus 59? Or are you trying to check if the slider is between the value 1 and 59? Because at the moment you are doing the first.


Return to posts index

Nicholas Deines
Re: Multiple if/else expressions for one value
on Jun 3, 2020 at 4:39:17 pm

I was trying to do between 1 and 59. I was trying to figure out how to do that.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]