Skip to main content
Participating Frequently
Dec 2, 2021 1:25 PM UTC
Answered

Start playing a pre-comp at a certain time

I have animation about 2 minutes long. It consists of 10 photo frames where each frame shows a simple animation. The camera moves from frame to frame and when the camera focuses on a frame, the animation is played for that frame. Is it possible to start playback of a pre-comp at a certain time in the main comp?

Dan Ebberts
Dan EbbertsCorrect answer
Community Expert
Dec 2, 2021 10:26 PM UTC

I think you'd just turn on time remapping for the pre-comps and use a simple time remapping expression like this to start the playback at a specific time (at 3 seconds, in this example):

tStart = 3;
time - tStart;

The trick is figuring out how the expression knows it's time to start playback. You could use a layer marker, like this:

if (marker.numKeys > 0){
  tStart = marker.key(1).time;
  time - tStart;
}else
  0;

13 replies

Participant
Feb 12, 2025 3:59 PM UTC

@Dan Ebberts Dear Dan,
thank you for this wonderful expression. I'm trying to do the oposit (start at 0 and stop the animation of a precomp at a given marker). Is this possible? I really have no clue and I'm in research-mode since this morning.  Thanks in advance.

Translate
Dan Ebberts
Community Expert
Community Expert
Feb 12, 2025 5:07 PM UTC

I'm not sure exactly what behavior you want, but this example should play normally until the first marker, then freeze:

m = marker;
t = time;
if (m.numKeys > 0){
  t = Math.min(time,m.key(1).time);
}
t
Translate
Participant
Feb 13, 2025 9:20 AM UTC

thank you so much dan! this whichcraft is exactly what I meant. you helped me a lot with it. Much appreciated. I wish you a pleasent day.  

Translate
Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
Dec 2, 2021 10:26 PM UTC

I think you'd just turn on time remapping for the pre-comps and use a simple time remapping expression like this to start the playback at a specific time (at 3 seconds, in this example):

tStart = 3;
time - tStart;

The trick is figuring out how the expression knows it's time to start playback. You could use a layer marker, like this:

if (marker.numKeys > 0){
  tStart = marker.key(1).time;
  time - tStart;
}else
  0;
Translate
rikilAuthor
Participating Frequently
Dec 3, 2021 7:58 AM UTC

You are a hero! I put the second code in each pre-comp and a Labelmarker where I want the animation to start playing.

Translate
Community Expert
Dec 2, 2021 9:47 PM UTC

Just drag the pre-comp forward or backward in the timeline. Pre-comps, or more accurately, nested compositions are just like footage. They have in point, out point, and duration. Where they are in the timeline determines when playback begins.

Translate
rikilAuthor
Participating Frequently
Dec 3, 2021 6:30 AM UTC

I was a little vague. The first frame should be visible at all times in each photo frame during the animation and then played at a certain time. If I move the animation along the timeline, they are not visible all the time.

Translate
Mylenium
Legend
Dec 2, 2021 2:56 PM UTC

I suggest you read up on time-remapping and all that stuff in the online help if simply staggering the layers doesn't do it. Of course you're still gonna need extra keyframes and also account for the paly time in your camera movement.

 

Mylenium

Translate