Is Canvas Scaling More Performant Via Css Or Js?
The following document mentions some guidelines for performant scaling of HTML5 Canvas: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Optimizing_canvas#Scali
Solution 1:
Assuming you're not doing anything crazy, just set it to be the size you need. The performance difference will be negligible.
Solution 2:
By scaling in CSS you don't change your canvas "computed" size, which means, by scaling up, you'll lose displayed quality.
If you have to scale with CSS, try with JS to scale the actual size of the canvas to match, pixel per pixel, on user's screen.
Baca Juga
- Javascript: Is There A Better Way To Retain Your Array But Efficiently Concat Or Replace Items?
- Difference In Performance Between Calling .localecompare On String Objects And Constructing A Purpose-made Intl.collator Object?
- Why Hardware-accelerated Css Animation Cost Too Much "composite Layer" Times In Main Thread?


Post a Comment for "Is Canvas Scaling More Performant Via Css Or Js?"