canvas quality | Sololearn: Learn to code for FREE!

+2

canvas quality

how to increase the quality of canvas ? Because it is not have enough quality to display sensitive animations

4/25/2019 2:00:51 AM

Roopesh

5 Answers

New Answer

+5

my idea will be to do this in JS var W=canvas.width=innerWidth*4; var H=canvas.height*4; this way quality it will become 4 times the aspect ratio of window ... (make sure u use Variables W and H in your entire code for collisions) then in CSS use canvas width:100% to make sure it dont overflow from viewport width :)

+5

Very_Hard(asm & js & c++ & java & py & (@Hard)) but i think he asked for quality .. not smooth animation 😁..

+3

requestAnimationFrame(func); it might help... https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame

+3

This document then... ctx.imageSmoothingEnabled https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled

+3

Prashanth Kumar you are right I asked for quality . But keyboard resulted it as quantity