Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Controlling an object from another composition

  • Controlling an object from another composition

    Posted by Luc Adriaens on November 7, 2018 at 1:43 pm

    Hi all!
    I’m fairly new to expressions and struggling with some basic concepts, so bear with me.

    I have created a NULL in one composition and would like to control the position of this null in another composition.
    When I add this to the position…

    comp(“COMPNAME”).layer(“LAYERNAME”).position

    … the null in “Compname” jumps to another location.

    I understand that the position of the null is RELATIVE to the position in the other composition, thus explains the jump.
    So I need to get/feed the WORLD POSITION(?) instead.

    I found info about “Layer Space Transform” and this seems the solution but I have trouble to write the code correctly.
    I need a variable to store this info?

    VAR=startPoint.toWorld(VAR.anchorPoint);

    Any thought/help for writing the correct expression (with explaination?)

    Thx in advance!!
    Luc

    Luc Adriaens replied 7 years, 6 months ago 2 Members · 6 Replies
  • 6 Replies
  • Alex Printz

    November 7, 2018 at 4:53 pm

    Try this, will work if the comp dimensions are the same:

    L = comp("COMPNAME").layer("LAYERNAME");
    L.toWorld(L.anchorPoint)

    Alex Printz
    Mograph Designer

  • Alex Printz

    November 7, 2018 at 4:55 pm

    but, if the comp you’re applying this expression to is parent to another layer, you have to counter it’s parents position. That would be:


    L = comp("COMPNAME").layer("LAYERNAME");
    parent.fromWorld(L.toWorld(L.anchorPoint));

    Alex Printz
    Mograph Designer

  • Luc Adriaens

    November 7, 2018 at 5:21 pm

    Thx Alex!
    The compositions have different dimensions…
    When applying the expression, the position of the objects still change.

  • Alex Printz

    November 7, 2018 at 5:26 pm

    if the compositions have different dimensions, then there is no way to get them to align as there is no ‘correct’ alignment.

    What I would do is using the first position statement L.toWorld(L.anchorPoint) parent your layer to a copy of the target comp inside of the main comp.

    If you didn’t intend to have the target comp inside the main comp, make the target comp inactive (turn off eye), but then you can move the target comp around and align them correctly.

    Alex Printz
    Mograph Designer

  • Luc Adriaens

    November 7, 2018 at 5:51 pm

    Ough! You lost me… sorry.

    I have an eye controller in one composition (character/smaller size comp).
    For easier animating, I would like to use a Null or object in the main comp that is linked to the controller of the eyes in the other comp.

    Maybe there’s an easier solution for this?

  • Luc Adriaens

    November 7, 2018 at 7:03 pm

    I have enlarged the other composition and it doesn’t seem to have any effect on the rig.
    First expression works like a charm!
    Thx, Alex!
    Appreciated!
    Luc

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