Sample App

Let's init a very slooooow loop and compare how the page and animation behaves in both cases.

Without Web Workers

Complex calculations block the main thread so the animation is laggy, not smooth, or even frozen. The page might become unresponsive.

With a Web Worker

If we extract all the complex calculations in a worker, the animation stays smooth and the page keeps being responsive.