Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Control Error Expression

  • Control Error Expression

    Posted by Tiago Cav on June 3, 2015 at 1:54 pm

    I’m using an expression with “sourceRectAtTime ()” in the Scale of a text. Works correctly, but when I turn out the text completely, the expression results in an error. Because try to find a value in “sourceRectAtTime ()” which is 0, but my expression is a calculation that divides a value by “sourceRectAtTime ()”. And can not divide a value by 0, this is the error.

    Is possible use a try/catch block which will test a block of code for errors while executing; if an error in the try block occurs, then the catch block is executed.

    But I do not understand how it applies.

  • I want to know how to use it for use when no letters in the text layer, not cause mistake, just turn off the expression.
  • I want to know, also:

  • How to represent “None” in an expression?
  • I need use this Expression, adding a control of Errors.
    s = 70/sourceRectAtTime().height * 100;
    [s,s]

    Thanks.

Tiago Cav replied 10 years, 11 months ago 2 Members · 5 Replies
  • 5 Replies
    • Kevin Camp

      June 3, 2015 at 4:39 pm

      there’s a few ways to handle it. try this:

      h = sourceRectAtTime().height;
      if (h=0) s=0 else s = 70/h*100;
      [s,s]

      Kevin Camp
      Art Director
      KCPQ, KZJO & KRCW

    • Kevin Camp

      June 3, 2015 at 10:55 pm

      sorry Tiago, I made a mistake in the syntax.

      try this:

      h = sourceRectAtTime().height;
      if (h==0) s=0 else s = 70/h*100;
      [s,s]

      Kevin Camp
      Art Director
      KCPQ, KZJO & KRCW

    • Tiago Cav

      June 4, 2015 at 2:08 am

      Awesome! Work perfectly.

      How to represent “None” in an expression?

      Thank you so much!

    • Kevin Camp

      June 4, 2015 at 5:33 pm

      you can usually represent none with empty quotes: “” or

      Kevin Camp
      Art Director
      KCPQ, KZJO & KRCW

    • Tiago Cav

      June 4, 2015 at 7:16 pm

      Thank you!

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