Closed loonywizard closed 3 years ago
Well, I have tested performance by measuring FPS while calling addConfetti
method every 100ms and here is the result
ctx.fillStyle
only 8 (number of colors) times instead of +1000 (number of confetties on the screen) doesn't have any performance impactctx.moveTo
(while having less beginPath / fill calls) slowers FPS in 2 times in my tests
Group confetties by color to optimize canvas drawing, batch same-color confetties drawing togheter
MDN Optimizing canvas