ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Error with opacity expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Justin Sarceno
Error with opacity expression
on Mar 15, 2019 at 11:49:16 pm

Having an error with this opacity expression in CC2019:

opacityEven = 50;
opacityOdd = 100;
f = timeToFrames();
if (f%2 == 0) opacityEven else opacityOdd

Message:
After Effects warning: Expression Disabled
Error at line 1 in property 'Opacity' of layer ('xyz') in comp
'xyz'.

Undefined value in expression (could be an out of range array subscript?)


Return to posts index

Dan Ebberts
Re: Error with opacity expression
on Mar 16, 2019 at 12:06:15 am

That single-line if/else syntax won't work with the new JavaScript engine. Try changing the last line to this:

(f%2 == 0) ? opacityEven : opacityOdd



Return to posts index

Justin Sarceno
Re: Error with opacity expression
on Mar 16, 2019 at 12:20:04 am

Hi Dan, I tried that exact expression and got this error:

ReferenceError: f is not defined


Return to posts index


Dan Ebberts
Re: Error with opacity expression
on Mar 16, 2019 at 12:23:04 am

Did you replace just the last line? The whole expression would be like this:

opacityEven = 50;
opacityOdd = 100;
f = timeToFrames();
(f%2 == 0) ? opacityEven : opacityOdd


Dan



Return to posts index

Justin Sarceno
Re: Error with opacity expression
on Mar 16, 2019 at 4:28:17 am

My bad, I just replaced the last line and it now works. Thank you so much!


Return to posts index

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