Demonstrates the procedure for converting an animated HTML Element to an animated GIF.
This process works for HTML elements animated with CSS (keyframes, transformations) or Javascript.
- Animate an HTML Element
- At each frame
- Convert DOM element to PNG
- Write PNG to Canvas
- Encode canvas as GIF
This is demo code. Look at index.html
and gifmaker.js
for the entry points.
The hard work of processing is done by the dom-to-image and jsgif libraries.