ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

If else expression with references

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Brice Munn
If else expression with references
on Feb 11, 2020 at 1:45:34 pm

Hi,

Forgive the shoddy syntax, I'm no expert with expressions. I'm struggling to make this work. It's the "if" part that's failing.

Basically I'd like to use "t" in a calculation, and I'd like "t" to mean "1" if "q" is less than or equal to "g", otherwise I'd like "t" to mean "0".

The error AE returns is on line 8 (starting if...) "Syntax Error: Unexpected Token: <="

Hope that makes sense!

m=effect("Opacity Animation Multiplier")("Slider")/100;
d=thisComp.layer("Global Control").effect("Opacity Deviation")("Slider");
s=thisComp.layer("Global Control").effect("Opacity Speed")("Slider");
q=1;
g=thisComp.layer("Global Control").effect("Number of digits")("Slider");
t=
{
if(q&lt;=g){1}else{0}
};

((wiggle(s,d)*0.5)+10)*m*t;


Return to posts index

Dan Ebberts
Re: If else expression with references
on Feb 11, 2020 at 8:16:48 pm

try changing the section that defines t to this:

t = (q <= g) ? 1 : 0;


Dan



Return to posts index

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