Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Parenting across compositions

  • Parenting across compositions

    Posted by Rosa Hughes on July 23, 2013 at 12:58 am

    Hi,
    I have 2 compositions using cut-out animation. One composition [Main] contains the background with special effects like lens flares. The second composition [Precomp Man] contains a man swinging a sword. [Precomp Man] sits in [Main]. I’d like the flares in [Main] to be parented to the sword which is in [Precomp Man]. I can’t put the flares in [Precomp Man] because I need to put special effects on the man (he is made up of pieces).

    I have already tried using the code below on the lens flare in [Main], but it doesn’t do anything because my sword’s position isn’t actually moving (it’s parented to the hand, which is parented to the arm etc).

    I think that I have to make the sword’s position and rotation an absolute value that can be read by the lens flare, but I don’t really know how.

    Any help would be appreciated 🙂

    comp("Precomp Man").layer("Sword blade").transform.position

    Dan Ebberts replied 12 years, 9 months ago 2 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    July 23, 2013 at 2:11 am

    If everything is 2D, something like this should work:

    L1 = comp(“Precomp Man”).layer(“Sword blade”);
    L2 = thisComp.layer(“Precomp Man”);
    fromComp(L2.toComp(L1.toComp(L1.anchorPoint)))

    Dan

  • Rosa Hughes

    July 23, 2013 at 4:25 am

    Everything is 2D, thanks for the code.
    I forgot to mention that my [Main] comp is 500×500 pixels, and my [Precomp Man] is 1511×1511. The flare is definitely moving at the same time as the sword, but it’s not sticking to it like it should be. Could this be because of the different sizes?

  • Dan Ebberts

    July 23, 2013 at 4:52 am

    That shouldn’t matter. Is anything non-square pixels? Does your Precomp Man layer start at some time other than zero in the main comp?

    Dan

  • Rosa Hughes

    July 23, 2013 at 5:00 am

    Everything is square pixels. Everything starts at zero and is the same time length.
    I have a fake camera move in [Main] that consists of a scaling solid that everything is parented to. Could this be messing with anything?

  • Dan Ebberts

    July 23, 2013 at 5:53 am

    It shouldn’t be. I can’t get it to fail with any combination of the things you mentioned. Hard to say without seeing it.

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