FORUMS: list search recent posts

Pre-comp uses parents time line?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Paul Stevenson
Pre-comp uses parents time line?
on Jun 17, 2015 at 12:24:27 pm

Is it possible for a child pre-comp use the parents timeline for it's timings?

So if I pass a child values from the parents timeline, based on it's frame position, and those values are put into an a expression that animates something. Is it possible to have the animation (in the child pre-comp) honour it's position in the parents timeline and ignore it's own timeline?

Thus when I move the child about in it's parents time (thus the values it's given adjust), it doesn't try and use it's own timeline and end up with offset timings (because it's been moved in time on the parents timeline and the timelines times don't match up)?

I am effectively using the pre-comp as a container, a directory if you will, to keep things tidy on the main (parent) timeline.


Return to posts index

Dan Ebberts
Re: Pre-comp uses parents time line?
on Jun 17, 2015 at 4:09:00 pm

You have to know the name of the parent comp, and then an expression can look for its own comp as a layer in the parent comp and compensate for the offset timelines with something like this:

C = comp("parent comp");
ctrl = C.layer("controls").effect("Point Control")("Point");
L = C.layer(thisComp.name);
ctrl.valueAtTime(time+L.startTime)


Dan



Return to posts index

Paul Stevenson
Re: Pre-comp uses parents time line?
on Jun 26, 2015 at 4:26:32 pm

Dan thanks for the response and sorry for the delay in getting back to you, I have been busy on other projects and just got back to this today.

I am not quite sure what your code is doing and I definitely couldn't get it working, but I am a bit of an expressions noob.

However I did manage to find a solution.

As I said, I am passing values from the parent to the child, so I merely adjusted those values. Instead of using a straight...

timeToFrames(thisLayer.inPoint)

...on a slider that is then read by the child, I adjusted it a little:

TimePoint=timeToFrames(thisLayer.inPoint);
TimeOffset=timeToFrames(thisLayer.startTime);

TimePoint-TimeOffset;


For the benefit of anyone reading this that doesn't understand the above:

This now takes the in point and the point in time on the layer that it starts (subtly two different things - one being a shifted time and one being a cropped to time - It's quite probable that both can exist at the same time) and takes one from the other. This calculates the time adjusting for offset. The child can then read this.

For anyone looking for code on how a child can read something from the parent, this will get you started:

comp("Parent").layer(thisComp.name).effect("Slide START")("Slider");

Just in case anyone is searching for the same things I was a few days ago.


Return to posts index

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