How to draw in canvas | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to draw in canvas

I don't understand how to draw in canvas and I keep learning it time to time and I need to learn it so bad can someone please explain it to me how it works

23rd Oct 2020, 9:55 AM
Life
Life - avatar
10 Answers
+ 6
The HTML <canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript). The <canvas> element is only a container for graphics. You must use a script to actually draw the graphics. Canvas has several methods for drawing paths, boxes, circles, text, and adding images. Learn more here: https://www.w3schools.com/graphics/canvas_intro.asp
23rd Oct 2020, 10:38 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
24th Oct 2020, 12:34 PM
Behrang Haghdoust
Behrang Haghdoust - avatar
+ 3
Thanks
24th Oct 2020, 3:18 PM
Life
Life - avatar
24th Oct 2020, 6:00 PM
MOHAMMAD AZMAL ALI
MOHAMMAD AZMAL ALI - avatar
+ 2
https://www.sololearn.com/learn/HTML/2201/?ref=app
23rd Oct 2020, 10:01 AM
Abhay
Abhay - avatar
+ 2
Thank you Abhay
23rd Oct 2020, 10:02 AM
Life
Life - avatar
+ 2
I want to use it to draw my game I am building
23rd Oct 2020, 10:09 AM
Life
Life - avatar
+ 2
Thanks wow it worked
24th Oct 2020, 6:57 AM
Life
Life - avatar
+ 1
Rasheed Galeeb Canvas is something like painting app ,anything you draw is literally painting of pixels and it doesn't remembers at all the previous states ,if you have to move object you need to clear previous pixels and paint new pixels at different coordinates ,it does provides methods to ease common tasks and manipulating videos and images , You can use mdn docs to learn in more detail about the canvas api , https://www.google.com/url?sa=t&source=web&rct=j&url=https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API&ved=2ahUKEwjhj9fdu8rsAhVtyjgGHffvBuwQFjAAegQIARAB&usg=AOvVaw1rj1bnlTH9dXzazYommbi7
23rd Oct 2020, 10:05 AM
Abhay
Abhay - avatar
+ 1
It will be difficult to do even common task using canvas, surely you will be able to make one if you are determined to do so ,good luck !
23rd Oct 2020, 10:11 AM
Abhay
Abhay - avatar