Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Error with opacity expression

  • Error with opacity expression

    Posted by Justin Sarceno on March 15, 2019 at 11:49 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?)

    Justin Sarceno replied 7 years, 5 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    March 16, 2019 at 12:06 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

  • Justin Sarceno

    March 16, 2019 at 12:20 am

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

    ReferenceError: f is not defined

  • Dan Ebberts

    March 16, 2019 at 12:23 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

  • Justin Sarceno

    March 16, 2019 at 4:28 am

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

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