FORUMS: list search recent posts

Linking nulls in two comps of different dimensions

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Josh Brine
Linking nulls in two comps of different dimensions
on Aug 8, 2017 at 7:39:56 pm

I am trying to attach an image to a null that is linked to another null in a different compostion,

currently i can use this expression on the main null to link to the position of the null in another composition 'comp("Scene 1").layer("Null 5").transform.position;'

However i want to scale down the comp im referencing and the scale does not translate to the null in the main comp

the only way i can think of solving this is to have the comp im referencing be the correct size to begin with


Return to posts index

Cassius Marques
Re: Linking nulls in two comps of different dimensions
on Aug 8, 2017 at 8:05:37 pm

Just normalize the transformations. Divide the X,Y position of the reference null by its composition height and width (respectively). Then multiply by the current composition's height and width.

assuming for example you have a 1080p and a 720p comp, your null from the 720p comp would have:

x=comp("1080p").layer("1080null").position;
[x[0]/1920*1280,x[1]/1080*720]


as an expression applied to it's position instead of simply pick whipping.

Cassius Marques
http://www.zapfilmes.com


Return to posts index

Cassius Marques
Re: Linking nulls in two comps of different dimensions
on Aug 8, 2017 at 8:10:45 pm

This will also work if you scale the composition (and not change its resolution). Just multiply the position by 100/your scale.

Cassius Marques
http://www.zapfilmes.com


Return to posts index


Cassius Marques
Re: Linking nulls in two comps of different dimensions
on Aug 8, 2017 at 8:44:37 pm

I wasn't very clear...

so, if you're scalling and/or changing resolution, try:

ref=comp("scene 1");
a=comp("scene 1").layer("null 5").position;
b=100/comp("scene 1").layer("scene 2").scale[0];
nx=a[0]-ref.width/2;
ny=a[1]-ref.height/2;
[nx*b+(thisComp.width/2),ny*b+(thisComp.height/2)]


and tell me how it goes...

Cassius Marques
http://www.zapfilmes.com


Return to posts index

Cassius Marques
Re: Linking nulls in two comps of different dimensions
on Aug 8, 2017 at 8:54:53 pm

I may have understood the opposite of what you wanted. You want to scale the composition of the reference, right? Is that comp inside the one you're at? if so, try:

ref=comp("scene 1");
a=comp("scene 1").layer("null 5").position;
b=100/thisComp.layer("scene 1").transform.scale[0];
nx=a[0]-ref.width/2;
ny=a[1]-ref.height/2;
[nx/b+(thisComp.width/2),ny/b+(thisComp.height/2)]


Cassius Marques
http://www.zapfilmes.com


Return to posts index

Josh Brine
Re: Linking nulls in two comps of different dimensions
on Aug 8, 2017 at 9:42:14 pm

Thanks for the quick responses all!

I will check out those expressions when i get back on the computer tommorow and let you know, but for clarity here is what i am attempting to do, and how far i have gotten so far.

1) animated whiteboard animation is the goal.
- I created some drawings in AI,
- imported into after effects
- used trim paths on shape layers to animate the shapes being drawn,
- created null object and copied path of shape onto position of null to create an animated path, adjusted to match the speed of trim path. (at this point the null was offset due to different sizes of comp and AI images so in AI i made the artboard 1920x1080 same as the comp i was working in, and copied the anchor point data from the shape onto the null before copying the path, this resulted in a null perfectly following the shapes as they are drawn.

Here is the thing,

the idea is to have several images in a 1920x1080 final frame,) so i created a null in the master comp, and linked the position of the null in the precomp to it. however scaling the comp offsets the master null. so i wanted to compensate for that maybe with expressions (which i think is what you guys understood.) (the master null is what i want to attach the image of the pen onto so its size remains constant etc

there are other ideas such as creating smaller comps using the same technique so they dont have to be scaled down at all, however this limits my ability to adjust them on the fly.


Return to posts index


Cassius Marques
Re: Linking nulls in two comps of different dimensions
on Aug 9, 2017 at 1:49:38 pm

the last expression I wrote works for scale, but you can't offset any position, that would require a lot more math to address the space transformations.

Cassius Marques
http://www.zapfilmes.com


Return to posts index

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