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 Respostas
+ 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