• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Start playing a pre-comp at a certain time

New Here ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

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?

TOPICS
Expressions , How to

Views

801

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 02, 2021 Dec 02, 2021

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;

Votes

Translate

Translate
LEGEND ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 27, 2024 Mar 27, 2024

Copy link to clipboard

Copied

Genious, thanks a lot!

Is there a way to start the compostion all over again with a second and third and fourth marker?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 27, 2024 Mar 27, 2024

Copy link to clipboard

Copied

Try this:

t = 0;
m = marker;
if (m.numKeys > 0){
  n = m.nearestKey(time).index;
  if (time < m.key(n).time) n--;
  if (n > 0){
    t = time - m.key(n).time;
  }
}
t

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 27, 2024 Mar 27, 2024

Copy link to clipboard

Copied

LATEST

that works, awesome! Thanks a million :))

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines