stuartpb / surpass

Taking sensitive field input beyond the ordinary
https://stuartpb.github.io/surpass/demo.html
MIT License
1 stars 0 forks source link

Transition-based typing animation #10

Open stuartpb opened 8 years ago

stuartpb commented 8 years ago

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.

stuartpb commented 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.