To make our canvas visible, we can give it a border by writing some JavaScript code. ? Give the canvas a background colour and a border This is because, by default, the canvas is empty and has no background. ![]() If you refresh your browser page where you previously opened snake.html you will now see a blank page. Your snake.html file should now look like this. The width and height are the dimensions of the canvas, and should also be specified. ![]() We will use it to access the canvas later. The id is what identifies the canvas and should always be specified. Replace the welcome message in snake.html with the following:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |