Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Null Object’s position

  • Null Object’s position

    Posted by Jace Bradley on March 13, 2023 at 11:26 pm

    Hi and thank you in advance. I trying to build a script, I have a button, when clicked, it will create a null object on top of selected layer. But, I want to null not to be linked. I want the null’s position be placed on the left boundary of selected layer but with the code I have , it always places the null’s position to the left of composition. Any help or ideas?

    // set the null object's initial position to the left boundary of the selected layer            nullLayer.transform.position.setValue([selectedLayer.sourceRectAtTime(0,false).left, nullLayer.transform.position.value[1], nullLayer.transform.position.value[2]]);
    Dan Ebberts replied 1 year, 2 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    March 14, 2023 at 12:52 am

    It’s too bad that there aren’t expression-like layer space transform equivalents in the scripting language, because what you really need here is toComp(). What I’d do is have the script temporarily add a point control to the selected layer, add a toComp() expression to it to calculate the layer’s left edge, harvest the result with the script, and delete the point control. The specifics depend on how you have things set up, but in general, that should work.

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