Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PointOnPath Expression not using anchor point

Enthusiast ,
Mar 14, 2023 Mar 14, 2023

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);
TOPICS
Expressions
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 14, 2023 Mar 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))
Translate
LEGEND ,
Mar 14, 2023 Mar 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 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 14, 2023 Mar 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2023 Mar 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))
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 15, 2023 Mar 15, 2023
LATEST

Thank you Dan! That did it!

 

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines