Copy link to clipboard
Copied
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...
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
...Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.