Teaching Guide

Elvenware Logo

TOC

Canvas Test

Create a program with an HTML canvas and draw some rectangles on it.

Submit the CanvasTest project that we did in class:

First declare the canvas in the HTML:

div

Canvas Object:

var c = document.getElementById("myCanvas"); var context = c.getContext("2d"); context.fillStyle = "#FF0000"; context.fillRect(0, 0, 10, 10);

Like this

window.onload = function() { var blockSize = 10; for (var i = 0; i < 5; i++) { Put everything in a folder called Week05_CanvasTest and check it in.