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?
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;
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
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.
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.
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;
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.
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?
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
Copy link to clipboard
Copied
that works, awesome! Thanks a million :))
Copy link to clipboard
Copied
@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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Dan, it's me again. I connected the number of the marker to a slider control, which works like a charm.
m = marker;
t = time;
if (m.numKeys > 0){
t = Math.min(time,m.key(thisComp.layer("Controller").effect("1")("Schieberegler")).time);
}
else 0;
Thank you a million times again.
Just out of curiosity... Let's say I want to start the animation at a certain marker and stop it at another certain marker with it's correnspondending contents in a precomposition (as example a counter from zero to nine and every marker number is representing the number in the precomposition at that time).
My approach was this (which you can guess is not working):
m = marker;
t = time;
startKey = thisComp.layer("Controller").effect("Start")("Schieberegler");
stopKey = thisComp.layer("Controller").effect("Stop")("Schieberegler");
if (m.numKeys > 0) {
startTime = m.key(startKey).time;
stopTime = m.key(stopKey).time;
if (t < startTime) {
t = startTime;
} else if (t > stopTime) {
t = stopTime;
}
}
t;
Where is my mistake? I just don't get it... This is just to much coding for me 😄
Copy link to clipboard
Copied
Like this maybe:
m = marker;
t = time;
startKey = thisComp.layer("Controller").effect("Start")("Slider");
stopKey = thisComp.layer("Controller").effect("Stop")("Slider");
try{
tStart = m.key(startKey).time;
tStop = m.key(stopKey).time;
t = linear(time,tStart,tStop,tStart,tStop);
}catch(e){
}
t
Find more inspiration, events, and resources on the new Adobe Community
Explore Now