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

# Layer width as it moves on Z axis

New Here ,
Mar 20, 2024 Mar 20, 2024

Copied

I’ve made this example to simplify the original situation; The red circle has the following expression in its position:

a = thisComp.layer(“CIRCLE-BLUE”);

b = a.toWorld(a.transform.anchorPoint);

c = thisComp.layer(“CIRCLE-BLUE”).content(“Ellipse 1”).content(“Ellipse Path 1”).size;

[ (b[0]+c[0]/2) , b[1] ]

It is using the blue circle size to be parented to the right corner of the blue circle.
But the blue circle is a 3D layer, and when I move it on the Z axis, the red circle can’t calculate its new position based on the blue circle’s size referent to the comp.

Is there a way to define blue circle’s width in real time as it moves on the Z axis?

TOPICS
Experiment , Expressions , How to

Views

87

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 Expert , Mar 20, 2024 Mar 20, 2024

I think this will work for your simplified test case. You may have to robustify it for your real world project:

``````a = thisComp.layer("CIRCLE-BLUE");
b = a.content("Ellipse 1").content("Ellipse Path 1").size;
c = a.toComp(a.anchorPoint + [b[0]/2,0]);``````

2 Replies 2
LEGEND ,
Mar 20, 2024 Mar 20, 2024

Copied

Create a 2D point control on the large ring and feed its coordinates into the toWorld() layer space transform instead of the anchor point.

Mylenium

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 Expert ,
Mar 20, 2024 Mar 20, 2024

Copied

LATEST

I think this will work for your simplified test case. You may have to robustify it for your real world project:

``````a = thisComp.layer("CIRCLE-BLUE");
b = a.content("Ellipse 1").content("Ellipse Path 1").size;
c = a.toComp(a.anchorPoint + [b[0]/2,0]);``````

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources
Troubleshooting FAQs
After Effects Community Recap
Getting started with After Effects