Skip to main content
Known Participant
August 13, 2018
Answered

Parent layer with expressions like Normal parent

  • August 13, 2018
  • 3 replies
  • 7525 views

Hi there,

How to parent a layer to other layer using expressions so that it acts like normal parent child.i.e

1.Rotate parent moves child etc...

This topic has been closed for replies.
Correct answer Deepwell

Well, sort-of. You can directly link the "child's" position to the "parents" position. For scaling and rotation you need a "relative link" (adding the parent's and child's values), if you still want to be able to animate the child's scaling and rotation. Important is that to animate/set the child's position, you need to use its anchor instead of its position value.

See it in action here:

AAE: Parent-Child via Expressions on Vimeo

Download the AAE document at:

http://tiefenbrunner.net/Parent-Child%20via%20Expressions.aep.zip

3 replies

Inspiring
June 25, 2020

Position is fairly easy you can use this expression to link to any layer's position within the comp no matter if its a child of other layers or not:

thisComp.layer("Null 1").toComp([0,0])

 

You can then try to link with expressions the other properties like scale and rotation but this might not always work, particularly if the parent is rotating or scaling.

 

When it comes to a true parent which includes rotation and scaling things get a bit more tricky. I think there are some complex expressions out there but a quick work around is much easier to remember. One method would be to duplicate the comp containing the child you wish to track, then link all the animating properties to the original comp with pickwhipped expressions (so you have an identical instance of that comp). Then simply hide all the linked layers and do a standard parent to the child layer you want to track. This is effectively rebuilding the parent tree with expressions. Might not always work but it's one way of doing it.

DeepwellCorrect answer
Inspiring
September 4, 2018

Well, sort-of. You can directly link the "child's" position to the "parents" position. For scaling and rotation you need a "relative link" (adding the parent's and child's values), if you still want to be able to animate the child's scaling and rotation. Important is that to animate/set the child's position, you need to use its anchor instead of its position value.

See it in action here:

AAE: Parent-Child via Expressions on Vimeo

Download the AAE document at:

http://tiefenbrunner.net/Parent-Child%20via%20Expressions.aep.zip

Mylenium
Legend
August 16, 2018

There is no such thing. You would have to re-create all transforms inside the expressions code using real hard math, so I suggest you explore other venues and structure your project suitably rather than making it require convoluted expressions.

Mylenium