Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects writing a simple script to set null object anchor point in the center?

  • writing a simple script to set null object anchor point in the center?

    Posted by Allison Sabelli on July 18, 2010 at 6:21 pm

    Hi everyone, I need some little help here, I’m very new to AE and scripting is unknown territory, however I’m learning by looking at other scripts and reading a lot. However I’m a little stuck here with the anchor point.

    I’m trying to write a simple script that adds a null object to a scene and set its size and its anchor point right in the center, so far I got everything I need but the anchor point :\

    here is what i got
    —————–
    var nw = 50;
    var nh = 50;
    var myNull = myComp.layers.addNull();
    myNull.source.name = “My NUll”;
    myNull.source.width = nw; // getting this right 🙂
    myNull.source.height = nh;
    myNull.source.anchorPoint = ???; //I know should be an array for [x,y,z] but I get errors if i try.
    myNull.threeDLayer = true;
    ——————

    I might be doing this all wrong, I don’t know ahhaha but how do i set the anchor point to be in the center?.

    Any help is very much appreciated, thanks

    Darby Edelen replied 15 years, 10 months ago 3 Members · 2 Replies
  • 2 Replies
  • Andy George

    July 18, 2010 at 7:33 pm

    Hi Allison,

    Just FYI You might get a better response posting this over at the expressions forum.

    -Andy George
    Senior Editor
    http://www.chiselindustries.com

  • Darby Edelen

    July 19, 2010 at 8:07 pm

    [Allison Sabelli] “myNull.source.anchorPoint = ???; //I know should be an array for [x,y,z] but I get errors if i try.
    myNull.threeDLayer = true;”

    I’m not familiar with scripting in AE, but I hope I know enough about general programming to help 🙂

    I’d say you want to set the layer to be 3D before you attempt to set the anchor point to a 3D vector. A 2D null object may not allow for a 3rd component in the anchor point.

    That’s the only thing I can think of from a non-AE scripting specific perspective.

    Darby Edelen

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