ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

prevent offseting when connect path to vertex with createPath

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
JuanLuis Vich
prevent offseting when connect path to vertex with createPath
on Jul 31, 2019 at 11:55:37 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!


Return to posts index

Santi Agustí
Re: prevent offseting when connect path to vertex with createPath
on Aug 8, 2019 at 3:51:38 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)


Return to posts index

JuanLuis Vich
Re: prevent offseting when connect path to vertex with createPath
on Aug 13, 2019 at 8:51: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?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]