4 ms·
Pretty cool, it seems to use the DOM directly instead of a <canvas> element, amazing it can perform as well as it does with constant css and element manipulatio
by gitgud 7y ago
Pretty cool, it seems to use the DOM directly instead of a <canvas> element, amazing it can perform as well as it does with constant css and element manipulation (notoriously slow)
I like that there's collision detection too!
- _bxg1 7y agoElement manipulation is normally slow because of layout computations, but explicit transforms remove the element from the layout flow (it doesn't affect nor get affected by the sizing and content of other elements), cutting nearly all of that cost. Also, in most browsers explicit transforms get computed on the GPU. So for this type of case there isn't nearly as much going on between the DOM and the raw graphics code as you might think