Clarity or Sharpness Issue? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Clarity or Sharpness Issue?

In canvas i have faced a problem that the clarity of the sketch any random color balls or anything i created! https://code.sololearn.com/WagxQo1z0C3e/?ref=app

28th Nov 2019, 2:20 AM
Mahesh Muttinti
2 Answers
+ 2
You're setting the width and height in CSS, but not on the actual canvas element The width by default is 300 and the height by default is 150 So you're CSS code is stretching it out Add the following under line 11 to fix your problem: canvas.height = h; canvas.width = w; Line 11 is: canvas.style=`height:${h}px;width:${w}px;background:#000` Let me know if you need help
4th Dec 2019, 4:44 PM
Erich Buelow
Erich Buelow - avatar