Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions prevent offseting when connect path to vertex with createPath

  • prevent offseting when connect path to vertex with createPath

    Posted by Juanluis Vich on July 31, 2019 at 11:55 pm

    Hi!
    I’m working inside a shape layer with 3 groups, one is balloon, another is box and another is rope.
    Rope should be a line, so I’m connecting both sides of the line to certain vertex up on the balloon and at the bottom on the box.

    With this code I have no problem as a starting setup:

    var pathTOP =content("balloon").content("blue").content("Path 1").path
    var pathBOTTOM=content("box").content("Path 1").path
    a=(pathTOP.points(time)[5]);
    b=(pathBOTTOM.points(time)[3]);

    TL=[a[0],a[1]]
    TR=[b[0],b[1]]

    createPath(points = [TL, TR], inTangents = [], outTangents = [], is_closed = false);

    But I had to move the balloon group, and instead of moving the path vertex, I moved the group. But doing that, the rope path loses the connect to his assigned vertex, due to that offset done with the group re-position
    (Same if I want to rotate the box group a bit)

    Do you know if it’s possible to tweak the code a bit to add some solution similar to toComp so I can move the groups or subgroups where the “balloon” path belongs, and the rope is still following that vertex with no offset?

    Thanks!

    Juanluis Vich replied 6 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Santi Agustí

    August 8, 2019 at 3:51 pm

    Hello!
    That’s a question I’d really love to know, too! for now, maybe this temporary approach may work for your scenario, just add the group position as an offset to your values, something like this:


    var pathTOP =content("balloon").content("blue").content("Path 1").path;
    var pathBOTTOM=content("box").content("Path 1").path;
    a=(pathTOP.points(time)[5]);
    b=(pathBOTTOM.points(time)[3]);

    offsetT=content("balloon").transform.position;
    offsetB=content("box").transform.position;

    TL=[a[0]+offsetT[0],a[1]+offsetT[1]];
    TR=[b[0]+offsetB[0],b[1]+offsetB[1]];

    createPath(points = [TL, TR], inTangents = [], outTangents = [], is_closed = false);

    but keep in mind that if you re-group or move the inner group position (in your case, “blue”), the vertex won’t follow that and will have the same issue as you described, so this is only a temporal possible patch until someone come up with a more flexible solution following the absolute position of the selected vertex
    (so even if the shape is grouped, sub grouped, etc, it will always will be attached to that exact vertex with no offsets)

  • Juanluis Vich

    August 13, 2019 at 8:51 pm

    thank you! it works for now

    that absolute position for the vertex connect expression would be a really awesome trick! I don’t know if that’s possible?

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