Skip to main content
Inspiring
March 14, 2023
Answered

PointOnPath Expression not using anchor point

  • March 14, 2023
  • 2 replies
  • 1724 views

I guess I'm missing something regarding the PointOnPath property.

 

When placing a Solid on the position of a Path Point, it takes te right lower corner in stead of the Anchor Point for the position (see screenshot).

How can I get it to work with the actual Anchor Point?

 

This is my expression in the position property of the Solid:

p = thisComp.layer("Shape Layer 1").content("Shape 1").content("Path 1").path.pointOnPath(0);
toComp(p);
Correct answer Dan Ebberts

Try it this way:

L = thisComp.layer("Shape Layer 1");
p = L.content("Shape 1").content("Path 1").path;
L.toComp(p.pointOnPath(0))

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
March 14, 2023

Try it this way:

L = thisComp.layer("Shape Layer 1");
p = L.content("Shape 1").content("Path 1").path;
L.toComp(p.pointOnPath(0))
Inspiring
March 15, 2023

Thank you Dan! That did it!

 

(Is it because the Solid was in Layer Space?)

Mylenium
Legend
March 14, 2023

You need to account for the difference in coordinate origin - center vs. top left corner - and subtract half the width and height.

 

Mylenium 

Inspiring
March 14, 2023

Thank you Mylenium, that is a logical thing to do, but it feels a bit like a workaround. I don't understand why the anchor point is ignored and, of all points, the right lowerhand corner is taken (while in other Ae-situations, the coordinates are taken from the center or left upper corner).

 

Do you have an explanation for that behaviour just for me to understand the logic?