Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Absolute location versus relative?

  • Absolute location versus relative?

    Posted by Ryan Hill on March 9, 2006 at 3:52 pm

    If a layer has a parent, the “position” property shows the layer’s position relative to that parent.

    But sometimes, for an expression, I want access to the layer’s absolute position. How can I get this in the expression?

    Obviously, writing elaborate math to add the parent’s position to the child’s, with various functions to handle rotation and scaling isn’t a very nice solution.

    Ryan Hill replied 20 years, 1 month ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    March 9, 2006 at 4:32 pm

    In an expresion for that layer you would use:

    toWorld(anchorPoint)

    If you’re referring to the child layer from an expression in another layer you would do it like this:

    L = thisComp.layer(“your child layer”);
    L.toWorld(L.anchorPoint)

    Dan

  • Alon_a

    March 9, 2006 at 7:17 pm

    Dan, while we’re on the subject, could you say something about the difference between toWorld and toComp, especially for 3D layers? The information provided in the “Scripting Help” in AE does not really explain this. I think every time I tried it I ended up using toWorld, but I’m sure there’s a reason for having toComp there as well.

    Thanks!

    – Alon

  • Dan Ebberts

    March 9, 2006 at 9:12 pm

    toComp() is relative to the coordinate system established by the Camera view. A good example of when you would use toComp() instead of toWorld() is this opacity expression that makes a layer invisible when facing away from the camera:

    if (toCompVec([0, 0, 1])[2] > 0 ) value else 0

    Dan

  • Alon_a

    March 10, 2006 at 12:15 am

    Perfect. Thank you.

    – Alon

  • Ryan Hill

    March 10, 2006 at 2:37 pm

    Ah, excellent.

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