That is exactly what I needed!
One more thing… Some animations actually start before the note “hits”. For example, if my main Comp has a cube move across the screen entering screen Left and exiting screen Right, but the Trigger Marker is when the cube is in the center. In my PreComp for the cube’s animation the null “action” layer would have a Marker when the cube is centered. Using your time remap script as is, the cube would “pop” into existence in the center.
I changed the line…
if (marker.key(n).time > time){
to this…
if ((marker.key(n).time)-1 > time){
… to have the frames prior to the trigger marker be visible.
This works for the animation before the marker, but the cube disappears if it’s still visible when the next marker hits. Is there a way around this?
Also, using the same cube example, I would need the opacity expression to allow the layer to be at 100% if the animation starts before the “start” marker.
I’m assuming it’s correct that I can’t have a “start” and “stop” animation since the preComp is being time remapped. If the cube went across the screen for note “C#” and the same note happens again before the cube is finished moving across the screen, the cube would appear to snap back to it’s “start” marker position (not what I wanted). My work around for this has been to just duplicate the layer and add/remove markers as needed so that both instances of that note’s animation can play close together.
I know a LOT of this can be manually keyframed (but why?). I’m trying to streamline a workflow so that changing the piece of music is a simple matter of running the midi script to get my markers.
Thanks so much Dan!