What: OffscreenCanvas
allows <canvas>
rendering contexts (2D and WebGL) to be used
in workers. This can increase parallelism and better performance on multi-core
systems.
Support: Available in Chrome 69. FF is in development.
Demo: The canvas animation is fully driven inside of the worker. Worker.requestAnimationFrame()
is used to drive the animation withi the worker and pixels are manipulated / drawn to the canvas
using OffscreenCanvas
. The worker introduces jank to the
animation every so often to simulate a CPU-intensie operation. However, the main thread
says responsive!
Instructions: Select an image below. Click during jank. It stays responsive.