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

Is there any expression to get actual position value of a Child layer in composition?

Contributor ,
Mar 04, 2020 Mar 04, 2020

Copy link to clipboard

Copied

Yes the question is straight forward. Let me know if it possible. Thank you.

TOPICS
Expressions , How to

Views

3.8K

Translate

Translate

Report

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 2 Correct answers

Explorer , Mar 04, 2020 Mar 04, 2020
Watch for the toComp() function



Envoyé de mon iPhone

Votes

Translate

Translate
Explorer , Mar 04, 2020 Mar 04, 2020

The way toComp work is that it converts the coordinates of a point on the surface of a layer to its coordinates on the comp's screen so if it is offseted it may be that your targeted layer's anchor point doesn't match the coordinates that are between the toComp's parenthesis if the point you are trying to match is the layer's anchorpoint... and as rick pointed out that only works if you are trying to get a 2D coordinate otherwise you should use toWorld...

Votes

Translate

Translate
Explorer ,
Mar 04, 2020 Mar 04, 2020

Copy link to clipboard

Copied

Watch for the toComp() function



Envoyé de mon iPhone

Votes

Translate

Translate

Report

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
Contributor ,
Mar 04, 2020 Mar 04, 2020

Copy link to clipboard

Copied

It works but I've a little issue. Whenever I apply toComp([0,0,0]) it have some  variation in the result. X position differ by 0.5xxxx and Y Position differ by  74.60xxxx  May I know why is it happening?

Votes

Translate

Translate

Report

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 04, 2020 Mar 04, 2020

Copy link to clipboard

Copied

l = thisComp.layer("Null 1");
l.toComp([0,0,0])// returns the position of Null 1 relative to the comp - z axis will not match in 3D layers especially if you start dragging values

l = thisComp.layer("Null 1");
l.toWorld([0,0,0]) // will always match position coordinates for Null 1

Does that make sense? That is how it has always worked.

Votes

Translate

Translate

Report

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
Explorer ,
Mar 04, 2020 Mar 04, 2020

Copy link to clipboard

Copied

The way toComp work is that it converts the coordinates of a point on the surface of a layer to its coordinates on the comp's screen so if it is offseted it may be that your targeted layer's anchor point doesn't match the coordinates that are between the toComp's parenthesis if the point you are trying to match is the layer's anchorpoint... and as rick pointed out that only works if you are trying to get a 2D coordinate otherwise you should use toWorld...

Votes

Translate

Translate

Report

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 ,
Apr 08, 2024 Apr 08, 2024

Copy link to clipboard

Copied

The actual Position of a child layer ("Null 1" in this example) is retrieved by using the toWorld(AnchorPoint) function like this:

L = thisComp.layer("Null 1");
pos = L.toComp(anchorPoint);

If you need more than that, we need screenshots with the modified properties of the problem layers. Select the layers, press the 'u' key twice, then take a screenshot of the entire UI and share it.

Votes

Translate

Translate

Report

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
Explorer ,
Apr 29, 2024 Apr 29, 2024

Copy link to clipboard

Copied

LATEST

Yo! If anyone like me had trouble understanding what is going on with the toComp() function and how to use it, I found this really helpful https://www.youtube.com/watch?v=gSq19gpWwSU

Votes

Translate

Translate

Report

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