0
Canvas in HTML
So I really donāt understand about canvas. In lesson I donāt understand some information For example: What does it mean: var can = document. getElementById(ācanvas1ā); var ctx = can.getContext(ā2d) I should to write it in head And all of this code isnāt working (There is some code in <body>) So pls explain me, hot itās working! Thank you!
2 Answers
+ 2
First you need to know JavaScript to use canvas.
With code getElementById("canvas1") we select html tag with id of canvas1.
Than we choose Context to be 2d, for drawing in 2d on canvas( i dont know are there any other)
Than we draw on canvas using some code.
Where to place this code, well easiest is to place script at botom of body, we need html canvas to render on screen before selecting it.
I sugest you to learn JS and than continue with lection of canvas, thay add this in html because this is new tag added but this tag is like container for js, and probably give more information to search engine..
+ 1
Ths, I will learn JS