Hacker News new | ask | show | jobs
by bsimpson 3077 days ago
I don't know the internals of either.

In a Paint Worklet, the canvas is generated for you, and your painter is automatically called every time an input property changes.

In -webkit-canvas, you manually instantiate the canvas and manually repaint it.

It's the difference between reactive and procedural programming (even though the actual painter is procedural in either case).

Here's a gist I threw together showing how to use the same paint function with either API:

https://gist.github.com/appsforartists/e5d2a4b7826bf5962fad1...