DEV Community

loading...

Discussion on: JavaScript mouse drawing on the canvas 👨‍🎨

Collapse
youpiwaza profile image
max

Pretty neat. I used to teach a similar exercice.

I'd recommand using lowdash.debounce or throttle to optimize events (limit the drawing, as JS basic event system is consuming hard ^^')

Collapse
dailydevtips1 profile image
Chris Bongers Author

Good advice, but I wanted to showcase it in plain javascript, without using any packages.
Generally tracking mousemove fulltime is pretty hard yes, for some reason, this doesn't seem to spike CPU much.