ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Get the actual position a component in a child comp has in the parent comp and use it in another child comp to follow the movement and rotation

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jonas Millgård
Get the actual position a component in a child comp has in the parent comp and use it in another child comp to follow the movement and rotation
on Apr 7, 2019 at 12:59:45 pm

I'm fairly new to expressions and I’m trying to wrap my how to solve the following and your ideas and suggestions are most welcome as I feel a bit stuck of how to continue.

So, the storyboard start a circle which contain another two circles. To the large circle one end of two lines are connected. The whole object is moving and rotating.



As the camera zoom out more of these objects are revealed and they are connected to each other with the lines with their movements and roatation.



And finally it’s revealed that the objects are a part of a bigger connected world.



My idea was to create a container comp containing the elements of each objects i.e. circles and lines (beamer effect).
Then I could duplicate the container comp as many times as I needed and have them all in a parent comp.

- Intro Comp
- Obj container 01

- Main BG circle

- Inner circle #1

- Inner circle #2

- Line #1

- Line #2

- Obj container 02

- Main BG circle

- Inner circle #1

- Inner circle #2

- Line #1

- Line #2

- Obj container 03



The thing I got stuck on is how to connect e.g. the end of “Line #1” in “Obj Container 01” to center of “Inner circle #1” in “Obj container 02”.
What I don’t understand is how to address the actual center position of the “Inner circle” in “Obj container 02” that it has in “Intro Comp” and use that to connect end of “Line #1” in “Obj Container 01” So that end of the line would follow the movement and rotaion of "Inner circle #1" in "Obj container 02.

Your input is very much appreciated.

Thanks!
Jonas


Return to posts index

Dan Ebberts
Re: Get the actual position a component in a child comp has in the parent comp and use it in another child comp to follow the movement and rotation
on Apr 7, 2019 at 5:08:32 pm

I'm not sure this is exactly right, but it should give you the idea. You need to use toComp() and fromComp() to translate your position coordinates through the different comp levels. Something like this should give you the coordinates of layer "Inner Circe #1" in comp "Obj container 02" as seen from a layer inside comp "Obj container 01":

L1 = comp("Obj container 02").layer("Inner circle #1");
p1 = L1.toComp(L1.anchorPoint);
L2 = comp("Intro Comp").layer("Obj container 02");
p2 = L2.toComp(p1);
L3 = comp("Intro Comp").layer("Obj container 01");
p3 = L3.fromComp(p2);
fromComp(p3)


Dan



Return to posts index

Jonas Millgård
Re: Get the actual position a component in a child comp has in the parent comp and use it in another child comp to follow the movement and rotation
on Apr 7, 2019 at 8:47:51 pm

Thanks Dan!


Return to posts index


Jonas Millgård
Re: Get the actual position a component in a child comp has in the parent comp and use it in another child comp to follow the movement and rotation
on Apr 8, 2019 at 9:40:26 pm

Spot on Dan! 😍 👍
The Line from one container connected nicely to the other container.




May I also ask another question. As you can see in the attached image the connected line seems to be behind all of the layers.
Any tips or thoughts to get around that?

Thanks
Jonas


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]