Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions mask points following absolute coordinates of a shape layer’s path vertex

  • mask points following absolute coordinates of a shape layer’s path vertex

  • Peter Zeet

    September 24, 2019 at 12:41 am

    HI!
    sorry if this has been posted before (I was sure to have read something related in the past), I tried to find it, but had no luck.

    So, I need to link a mask path to a shape path in the same layer, and all ok except when the shape path’s transform position or anchor point is not [0,0].

    is it possible to get rid of that offseting, so the mask is always placed where the path is in absolute coordinates?

    right now I had the simplest
    thisLayer.content("The Path").content("Path 1").path;
    expression into the mask’s path, until I had to work with non [0,0] positioned path

    thanks in advance, and sorry to repeat if this is answered on an old thread

  • Dan Ebberts

    September 24, 2019 at 6:08 pm

    Try this:


    p = thisLayer.content("The Path").content("Path 1").path;
    v = [];
    pts = p.points();
    for (i = 0; i < pts.length; i++){
    v.push(toComp(pts[i]));
    }
    createPath(v,p.inTangents(),p.outTangents(),p.isClosed());

    Dan

  • Peter Zeet

    September 24, 2019 at 7:05 pm

    hi!
    thanks for the response!

    but it seems there is something weird happening, the mask is only at the correct position if the anchor point of the layer and the anchor point of the path shape group are the same (*-1) and the layer positio is twice the anchor point value, once you move from that position or change any other value (shape group’s position or anchor point), the mask position starts offseting a lot. It’s like having a weird parallax effect if you move from their absolute center

  • Peter Zeet

    October 29, 2019 at 4:47 pm

    hey!
    so, I’ve trying to figure out how to solve the parallax weird behaviour with the expression issue with no luck at all… any ideas? Reading the expression, it should work all ok, no?
    Now, applying to the mask, automatically the mask goes to a specific location. When you move the shape group the mask remains there, which is perfect.. but… the position where the mask is, is not the correct psoition, and it changes if you move the whole layer around the comp, pretty odd
    thanks again and sorry to bring the post up again!

  • Santi Agustí

    January 20, 2020 at 6:50 pm

    I had to face a similar problem, and modifying a bit Dan’s code make it work for me, maybe it can suit your needs temporary until a more versed expressionist can bring a cleaner solution than mine.


    p = content("The Path").content("Path 1").path;
    offsete=content("The Path").transform.position;
    v = [];
    pts = p.points();
    for (i = 0; i < pts.length; i++){
    v.push(toCompVec(pts[i]+offsete));
    }
    createPath(v,p.inTangents(),p.outTangents(),p.isClosed());

Viewing 1 - 5 of 5 posts

Log in to reply.

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