Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions After Effects unexpected error

Tagged: 

  • After Effects unexpected error

    Posted by Obed Ampong on February 6, 2023 at 8:45 pm

    Hello,

    I am trying to use sourceRect to align text on Essential Graphics Template but it keep resulting unexpected error. Please could someone help me out? Thank you in advanced.

    Below is the script

    a = thisComp.layer(“TEXT”).sourceRectAtTime();

    height = a.height;

    width = a.width;

    top = a.top;

    left = a.left;

    if (thisComp.layer(thisComp.layer(“Null 1”).effect(“ALIGNMENT”)(“Menu”)==1)

    {

    x = left;

    }

    else if (thisComp.layer(“Null 1”).effect(“ALIGNMENT”)(“Menu”)==2)

    {

    x = left + width / 2;

    }

    else {

    x = left + width;

    }

    [x,top + height]

    Regards

    Obed

    Obed Ampong replied 1 year, 10 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    February 6, 2023 at 9:43 pm

    One thing I see is that this line appears to be messed up:

    if (thisComp.layer(thisComp.layer("Null 1").effect("ALIGNMENT")("Menu")==1)

    Also, you might have issues using height and width as variable names, because those are layer attributes.

    Beyond that, what is the error message you’re seeing?

  • Manuel Moellmann

    February 6, 2023 at 10:36 pm

    as dan already mentioned:

    if (thisComp.layer(thisComp.layer(“Null 1”).effect(“ALIGNMENT”)(“Menu”)==1)

    –> if (thisComp.layer(“Null 1”)

    and maybe not really a problem but i would suggest to add some spaces to the condition:
    (“Menu”) == 1

  • Obed Ampong

    February 7, 2023 at 3:33 am

    Hi, Dan and Manuel. Thank you very much. It’s a shame I have been struggling with this and I didn’t notice it.

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