ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Controlling an object from another composition

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Luc Adriaens
Controlling an object from another composition
on Nov 7, 2018 at 1:43:09 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


Return to posts index

Alex Printz
Re: Controlling an object from another composition
on Nov 7, 2018 at 4:53:25 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


Return to posts index

Alex Printz
Re: Controlling an object from another composition
on Nov 7, 2018 at 4:55:37 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


Return to posts index


Luc Adriaens
Re: Controlling an object from another composition
on Nov 7, 2018 at 5:21:33 pm

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


Return to posts index

Alex Printz
Re: Controlling an object from another composition
on Nov 7, 2018 at 5:26:49 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


Return to posts index

Luc Adriaens
Re: Controlling an object from another composition
on Nov 7, 2018 at 5:51:37 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?


Return to posts index


Luc Adriaens
Re: Controlling an object from another composition
on Nov 7, 2018 at 7:03:22 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


Return to posts index

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