Watch me code this in ~25 minutes . Tested and fully works in Blink with the Experimental Web Platform features flag enabled.
Animations don't work in Firefox and Edge as CSS variables are not originally animatable, but flip at 50%. In this demo, they're animatable thanks to Houdini (no support in these browsers yet).
If you like this demo in particular and my work in general and you want me to be able to continue putting stuff out, please consider one of the following: