I had worked on a tool that does something similar to your requirements. It basically uses cutycapt (or any other tool to convert HTML with CSS into image) and takes series of screenshot depending on the frame rate required.
For that to work, the animations should be purely CSS animations and the tool interpolates the intermediate frame's CSS properties by parsing the CSS.
https://github.com/bpsagar/css2video
I'm not sure if the tool is complete, let me know if you are interested.