Summary
Understanding the retained mode and immediate mode differences makes it much easier to sympathize with the DOM on certain things and with the canvas
on others. By now, hopefully you have a good idea of when to use one over the other. In case it helps, here is my short list on when I use canvas
and when I use the DOM.
When I Use a Canvas
- Complex visualizations
- Animations involving content that nobody needs to interact with (example)
- Pixel manipulation (example)
When I Use the DOM
This is pretty simple. I use the DOM for everything else that I don't use a canvas
for. The canvas
has very limited uses for the kinds of things that I do.
Get hands-on with 1400+ tech skills courses.