Moderators: Disciple, zlovatt

Topic Author
Posts: 1
Joined: Tue Sep 08, 2015 7:56 am

link solid between different composition

Tue Sep 08, 2015 8:47 am


here is my problem:

To call A a composition of 1920/1080 px and B a composition of 1024/576 px.
A contains a solid S of 100/100 px (for example), located at the coordinates [x, y].
B contains A, and a solid S ', identical to S, at coordinates [x', y '].
I would like to connect the positions S and S ', S being the master, so that S' is superimposed exactly S.
NB: A has not undergone any scaling when integrated into B.

Thanks and sorry for my bad english.
Posts: 15
Joined: Sun Dec 10, 2006 10:23 pm

Re: link solid between different composition

Thu Oct 22, 2015 4:37 am

If comp A is sitting in the middle of comp B, you could make the solid S' a child of comp A and then just use the coordinates of solid S, since these coordinates will be relative to the comp-space of the nested comp A. So the expression would be:
comp("Comp A").layer("S").transform.position

If you think about it, if S is at the middle of comp A its coordinates will be [960,540]. In comp B, if S' is the child of the nested comp A then setting its coordinates to [960,540] will put it right over the middle of comp A and thus right over the layer S.

The advantage of this is that if you scale or rotate comp A inside comp B you don't have to change your expression.

If you can't parent the S' layer to comp A in comp B, then you just need to apply an offset, to make up for the fact that the [0,0] point of comp A is not at [0, 0] in comp B. The position of the top left of comp A in comp B is given by the expression
[comp("comp A").width - comp("comp B").width, comp("comp A").height - comp("comp B").height] / 2
which in this case works out to [-448, -252]. So you can calculate the position of S' by simply adding that offset to the position value of layer S thus:

offset = [comp("comp A").width - comp("comp B").width, comp("comp A").height - comp("comp B").height] / 2;
comp("Comp A").layer("S").transform.position + offset

or if you want to save some processing at the expense of hard-coding values into your expression:
comp("Comp A").layer("S").transform.position - [448, 252]

Who is online

Users browsing this forum: No registered users and 1 guest