ResizeObserver
has a new property in Chrome 84+ calleddevicePixelContentBox
, that allows you to create pixel-perfect canvases. This is important as off-by-one pixel errors with browser-internal pixel-snapping can lead to unpleasant Moiré effects.
Read more in the article on web.dev.
This demo may not be suitable for people prone to photosensitive epilepsy.