Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Get world-space xform from CornerPin that’s parented

  • Get world-space xform from CornerPin that’s parented

    Posted by Teo Camporeale on March 13, 2008 at 9:32 pm

    Hi all, Could anyone help with this? I want to acquire the world-space coordinates of each of the 4 corners from a parented, smaller precomp, which is being distorted with CornerPin.
    Example: everything happens in Comp1, which is 1280×720.
    There’s a keyframe animation (say, layer called “Hand”), to which a SMALL comp (like a postcard) is parented. The postcard comp size is 200×150, and it’s called “PC Card”.
    Normally, I could get the world-space x-y coordinates of “PC Card” pretty easily by doing something like;
    C = thisComp.layer(“PC Card”)
    C.toWorld(C.anchorPoint)
    The coordinates returned are for plugging into another FX, like say a particle generator.

    However, what I ALSO need to do, is have a CornerPin effect applied to the layer “PC Card”, and then be able to get the final world-space coordinates of the (for instance) Upper Left Corner of the corner-pinned “PC Card”. (I figure if I can do this for one corner, the other 3 should follow easily)

    Any advice is greatly appreciated!
    Thanks
    Teo

    Teo Camporeale replied 18 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Darby Edelen

    March 14, 2008 at 2:10 am

    [Teo Camporeale] “However, what I ALSO need to do, is have a CornerPin effect applied to the layer “PC Card”, and then be able to get the final world-space coordinates of the (for instance) Upper Left Corner of the corner-pinned “PC Card”.”

    You should be able to simply the expression you already have:

    [Teo Camporeale] “C = thisComp.layer(“PC Card”)
    C.toWorld(C.anchorPoint)”

    All you need to do is change the C.anchorPoint value to be the coordinates of the pin you want to retrieve from the Corner Pin effect (since these are in layer space if I’m not mistaken):


    C = thisComp.layer("PC Card");
    p = C.effect("Corner Pin")("Upper Left"); //I'm not sure if this is the correct code here, I don't use Corner Pin much and I don't have AE to check it, replace this with a reference to the pin coords if this is incorrect.

    C.toWorld(p);

    As you can see, the toWorld() function converts a point (any point, anchorPoint just happens to be a good one most of the time) on the given layer in layer space to a point in world space.

    Darby Edelen
    Designer
    Left Coast Digital
    Santa Cruz, CA

  • Teo Camporeale

    March 14, 2008 at 3:06 pm

    Thank you very much, worked like a charm! I still have trouble thinking more than 1 or 2 variables-deep with these things. It looks so obvious once you see it!
    Again, my thanks!
    -Teo

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