ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Peter Zeet
mask points following absolute coordinates of a shape layer's path vertex
on Sep 24, 2019 at 12:41:22 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


Return to posts index

Dan Ebberts
Re: mask points following absolute coordinates of a shape layer's path vertex
on Sep 24, 2019 at 6:08:14 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



Return to posts index

Peter Zeet
Re: mask points following absolute coordinates of a shape layer's path vertex
on Sep 24, 2019 at 7:05:41 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


Return to posts index


Peter Zeet
Re: mask points following absolute coordinates of a shape layer's path vertex
on Oct 29, 2019 at 4:47: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!


Return to posts index

Santi Agustí
Re: mask points following absolute coordinates of a shape layer's path vertex
on Jan 20, 2020 at 6:50:28 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());


Return to posts index

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