Open stuartpb opened 8 years ago
Ehh... I'm not sure about stopping the animation when the user isn't typing, actually, now that I think about it. I think it's kind of a significant feedback mechanism, saying "we're not currently displaying the shapes, because it looks like you're still typing".
Without that need, the JS-based animation becomes a lot more complexity for not a lot of gain, so... hmm.
Right now, the animation while typing and masking is one infinitely-looping keyframe animation (delayed per dot). It doesn't transition out of the animation if stopped mid-frame (at least not in Chrome), and is consequently harder to time an end for.
What I'd rather do is run a frame timer as soon as the user starts typing that fires every quarter-second to apply a class that jerks a dot (or skips a beat), so long as there was a keystroke since the last beat - and starts a timeout if there wasn't.
This also makes it smoother if the animation has to transition out mid-frame, ie. due to a mode change (full-stop for shrouding and direct-to-Gross-Simplification for exposure), as transitions to those modes are still in effect from whatever the animations' class-applied values were.