I am trying to "play" a video (16 frame animation) on command. I am using audio converted to keyframes (recording of a single note played multiple times, different rhythms), and I want to write an expression saying every time a note is played (>6.0 value would work for each note's beginning), this 16 frame animation plays through and then freezes on the last frame (0:00:00:15). It's important that it stops on the last frame of that layer while the rest of the timeline continues on. The effect would be that the animation is the note being played each time, in sync with the audio. But it needs to be an expression because it is too long to do manually.
This expression allows you to set value to occur when the key is greater then a number you set(30 in my code). Mine simply adds 100 to the position but you could do anything. If you wanted something smooth you should use the linear method or something to increment you value like a loop.
If it doesn't hit the value it stays the same as you have it set. I setup a switch that enables the effect or not. You could also use this to freeze it with a certain value other then the default you begin with.