ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Problems controlling layers in a precomp with a parent null object.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Terje Bergli
Problems controlling layers in a precomp with a parent null object.
on Aug 21, 2017 at 12:23:47 pm

I have several text layers in a pre-comp with these expressions to the scale and opacity.

Now moving the "cursor" null-layer in the parent composition works correctly. It interacts and controls the opacity and scale of the precomposed text layers (Kursdel-intro), fine ☺
BUT only if I move the "cursor" layer. I want to move the precomposition and get the same interaction with the "cursor" layer.

How do I move the precomp, with the null in a fixed position, and get the same effect?

//scale
minDist = 5;
maxDist = 100;
minScale = 50;
maxScale = 130;

C = comp("Kursdel-intro").layer("cursor");
dist = length(C.toWorld(C.anchorPoint),toWorld(anchorPoint))
s = ease(dist,minDist,maxDist,maxScale,minScale);
[s,s]

//opacity
dMax = 100;
dMin = 33;
d = length(comp("Kursdel-intro").layer("cursor").position,position);
ease(d,dMin,dMax,100,33);




Return to posts index

Scott McGee
Re: Problems controlling layers in a precomp with a parent null object.
on Aug 21, 2017 at 4:15:20 pm

C = comp("Kursdel-intro").layer("cursor");
and
d = length(comp("Kursdel-intro").layer("cursor").position,position);

This just needs to be relabelled to the name of the Precomp.

So change this "comp("Kursdel-intro").layer("cursor")" to "comp("Kursdel-intro").layer("NAME OF PRECOMP")"

I've just tested it on my machine, so as long as that's what you want to do. That should connect it to the precomp instead of the NULL Object.


Return to posts index

Ter Ber
Re: Problems controlling layers in a precomp with a parent null object.
on Aug 22, 2017 at 12:29:02 pm

Should be good enough for me and Scott McGee, but nope ☹
The pre comp text layers must be connected to the null/cursor in some way, or else I can't determine where the scale/opacity animation will kick in, right?
Thanks for helping Scott. I tried your fix, but then nothing happened, but you are probably onto something with the precomp target.
Here's a gif (PS in this the comp has changed name to "prealltext")

As you can see here I want the precomp "alltext" text layers to animate the same way it does when I move the "cursor" null layer.

Terje



Return to posts index


Scott McGee
Re: Problems controlling layers in a precomp with a parent null object.
on Aug 22, 2017 at 9:50:12 pm

Won't lie, haven't a foggiest. Tried a few things out. As it references the anchorPoint of the Master Comp, it's just the illusion that if it hovers over it works. It doesn't it's basing it off the anchor point of the Null and as long as your precomp compares to the null's anchor point it works.

I tried getting the precomped items to reference the null object and rework out the difference, but I think the toWorld is setting it in stone...(I won't lie don't know much about toWorld and toComp.) with no success.

best I can offer, as I hope Dan might look at this and go here's an answer, but if not try these

http://motionscript.com/design-guide/proximity.html
http://motionscript.com/design-guide/collision.html

The expressions for these are similar in a way the top one uses position over AnchorPoint, which I think might be more down the route you'll want. The one below is a little more complex, but again it has the similar idea of if something crosses paths it reacts.

This way might be a better solution, which you can precomp and get it to reference the cursor to the position, so when you move the position of the precomp, it should be able to rework itself out.

Apologies if the above waffle makes no sense, but in my head I think thats your best option.


Return to posts index

Ter Ber
Re: Problems controlling layers in a precomp with a parent null object.
on Aug 24, 2017 at 2:44:42 pm

No worries, Scott. I had to give up, animate the null and manually position-keyframe a precomp of the whole shebang. Works for now, but thanks a lot for taking the time, Scott.
PS I believe Dan was the origin of some of my script expressions. I'm sure there is a solution in his guide somewhere.



Return to posts index

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