Wow Dan! This is such a helpful Expression for triggering Time Remap.
I am trying to slightly modify it, so I can also specify a second threshold (slider-driven) that will set the time remap of the pre comp to a different time.
But all my attempts so far failed. To understand what I am trying to solve:
I am visualising the development of clubs/bars within the last century on a map. The information of each of the ~300 clubs/bars is loaded into AE via an .csv file (Location, Opening Year, Closing Year), each one being a (identical) pre comp.
So when the years-slider (starting 1900 till 2022 at the end) reaches the opening year of a club, this pre comp does start the animation (Opening Animation). Nice!
How can I add a second “treshhold” (Closing Year), that will make the pre comp continue playing at a later point in time (Closing Animation)?
Thx so much for any ideas and your awesome support, community.
open = 1965;
close = 2012;
year = thisComp.layer(„controller“).effect(„year“)(„Slider”);
check = false;
frame = Math.round(time / thisComp.frameDuration);
while (true){
t = frame * thisComp.frameDuration;
if (check){
if (year.valueAtTime(t) < open){
frame++;
break;
}
}else if (year.valueAtTime(t) >= open){
check = true;
}
if (frame == 0){
break;
}
frame–
}
if (! check){
t = 0;
}else{
t = time – frame * thisComp.frameDuration;
}