Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Linking expressions across comps

  • Linking expressions across comps

    Posted by Peter Hickson on April 26, 2007 at 1:53 am

    Hi, I am trying to link postion info for layers between 2 comps. I have been able to link the two layers, but the expression changes the values of my linked layer rather than moving them relative to the master layer. How can I offset or parent the layer. I can’t get the syntax right. Any suggestions would be much appreciated. Cheers. Peter

    Filip Vandueren replied 19 years ago 3 Members · 3 Replies
  • 3 Replies
  • Darby Edelen

    April 26, 2007 at 5:39 am

    [Peter Hickson] “I have been able to link the two layers, but the expression changes the values of my linked layer rather than moving them relative to the master layer.”

    comp("CompName").layer("LayerName").position will give you the position of the layer named ‘LayerName’ in the composition ‘CompName.’ However, I’m a little concerned that your question might be more complicated than that…

    The position value returned will be the position of ‘LayerName’ inside of ‘CompName,’ so if you’re using one of these (or both) as pre-comps inside another composition and trying to get position values for the layer in the ‘CompName’ relative to the composition it’s appearing in then it gets a little more complicated:

    thisComp.layer("CompName").toComp(comp("CompName").layer("LayerName").position);

    …should do it!

  • Peter Hickson

    April 26, 2007 at 9:38 am

    I really should have explained it a bit better. I have three comps that make one image across 3 screens. I was trying to link the base layers of the outside screens to the base layer of the centre screen so that as the centre screen panned up the outer screens would follow. I managed to get it to work by adding an offset to the end of the expression, but I was wondering if there was a slightly more elegant way of doing it without having to do the basic maths.

    the expression that i used was:
    comp name.(“layer name”).transform.position-[xoffset,yoffset]

    cheers
    peter

  • Filip Vandueren

    April 26, 2007 at 12:51 pm

    Usually this is done by animating everything in a superwide comp,
    then cropping when rendering 3 versions.

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