Monday, September 9, 2013





constant properties

canvas.width
and canvas.height ( from <canvas id="myCanvas" width="800" height="600"></canvas> )

declaration of variables

var x
= 10;
var y = 10;

Repeat loops example

for (var i=0; i<canvas.height; i+=20) {

context.beginPath();

context.lineWidth = i/20;

context.strokeStyle = "rgb("+i+",0,0)";

context.moveTo(0, 0);

context.lineTo(canvas.width, i);

context.stroke();

}

No comments:

Post a Comment