Can I draw in JS? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can I draw in JS?

This is probably a really dumb question, but I am trying to make a game that is web based so I was hoping to use JS to draw and animate the game.

10th Nov 2018, 4:47 PM
Michele Rene Machado
Michele Rene Machado - avatar
4 Answers
+ 3
If it is for a game, then it might be best to go with a canvas as the 'container' for your graphics: https://www.sololearn.com/learn/HTML/2201/ https://www.w3schools.com/html/html5_canvas.asp Since the canvas is only a container, you'll need JS to draw on it. You can find tutorials on the internet covering all the functions JS provides for that purpose, for example: https://www.w3schools.com/graphics/canvas_drawing.asp https://eloquentjavascript.net/17_canvas.html But there are lots more you can look into.
10th Nov 2018, 5:35 PM
Shadow
Shadow - avatar
+ 2
you can draw in.. html with svg.. css clip-path property js canvas
10th Nov 2018, 6:37 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 1
Okay, great, so I can draw using JS, I just need specific functions and whatnot! Thank you! And I am using the canvas tag as well so I know I am on the right track.
10th Nov 2018, 6:25 PM
Michele Rene Machado
Michele Rene Machado - avatar
0
I didn't know about clip path, thank you though!
11th Nov 2018, 8:38 PM
Michele Rene Machado
Michele Rene Machado - avatar