Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Referencing the layer index of another comp?

  • Referencing the layer index of another comp?

    Posted by John Madison on September 23, 2011 at 6:55 pm

    Hey guys,

    I have a comp with an image layer. I am going to nest this comp (call it A) into another comp B. Then i wish to duplicate instances of comp A in comp B. So far so good. However, I want to adjust the position (lets say X values) of the image layer in comp A based on the layer index value of comp A in comp B. Does this make sense? If so, is it possible?

    If it works then with every duplication of comp A layer, the image will have a different position. I can do a simple expression on Comp A layer and this will move with every duplication. However, i dont want to move comp A’s position in Comp B, but the image in Comp A only!

    Cheers!

    Dan Ebberts replied 14 years, 7 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    September 23, 2011 at 8:32 pm

    You can only get something like this to work if you duplicate Comp A in the project bin, give each copy a unique name, and bring them all into Comp B. You can’t do it by simply duplicating the Comp A layer in Comp B.

    Dan

  • John Madison

    September 24, 2011 at 9:56 am

    Dan,

    So you are saying that i need to add an expression on the position value of the image layer in comp A and then duplicate this in the project bin? If so, what will this expression look like?

    Thanks

  • Dan Ebberts

    September 24, 2011 at 3:45 pm

    Let’s say you want each copy to have the image 10 pixels farther to the right. You could add an expression like this to the image layer:

    idx = comp(“Comp B”).layer(thisComp.name).index;
    value + [10*idx,0]

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy