Skip to main content
Participant
March 20, 2024
Answered

Layer width as it moves on Z axis

  • March 20, 2024
  • 2 replies
  • 343 views

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?

This topic has been closed for replies.
Correct answer Dan Ebberts

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

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
March 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]);

 

Mylenium
Legend
March 20, 2024

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