Skip to main content
Participant
February 19, 2023
Answered

Expressions that work with layers in other Comps

  • February 19, 2023
  • 1 reply
  • 322 views

 

 

I need an expression that allows the "shape" layer to be placed in the center left of the "Shape layer 1".

 

What's wrong with my code?

rect = comp("Pre-comp 1").layer("Shape Layer 1").sourceRectAtTime();
[rect.left, rect.top + rect.height/2]

 

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

Try it this way:

L1 = comp("Pre-comp 1").layer("Shape Layer 1");
rect = L1.sourceRectAtTime();
p = L1.toComp([rect.left, rect.top + rect.height/2]);
L2 = thisComp.layer("Pre-comp 1");
L2.toComp(p)

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
February 19, 2023

Try it this way:

L1 = comp("Pre-comp 1").layer("Shape Layer 1");
rect = L1.sourceRectAtTime();
p = L1.toComp([rect.left, rect.top + rect.height/2]);
L2 = thisComp.layer("Pre-comp 1");
L2.toComp(p)