Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Detect whether array or number is needed?

  • Detect whether array or number is needed?

    Posted by Noel Powell on June 22, 2012 at 10:56 pm

    Hi. I have an expression that needs to work for basically all parameters. The expression returns a number, but I want that number to be of dimension 2 if needed. So if the expression returns the number 50, it should return 50 if the expression is in a Rotation parameter, and [50,50] if in the Scale parameter. I’ve tried the catch error statement but that doesn’t seem to work for this error. If I put the following code in the Scale parameter, I still get an error. Is there another way to detect if an array or number is needed?
    Thank you for your time.

    try
    { 50 }
    catch (error)
    { [50,50] }

    Noel Powell replied 14 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 22, 2012 at 11:43 pm

    Try this:

    if (value instanceof Array) [50,50] else 50

    Dan

  • Noel Powell

    June 22, 2012 at 11:52 pm

    That’s what I needed. Thank you again, Dan.

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