Empty Canvas

this is a good starting point for playing with canvas

by bjelline

HTML

<canvas id="c"></canvas>

CSS

#c {
    background-color: white
}
body {
    background-color: #ddd;
}

JavaScript

var w = 250,
    h = 250;
var my_canvas = document.getElementById("c");
var my_context = my_canvas.getContext("2d");

my_canvas.width = w;
my_canvas.height = h;
my_context.strokeStyle = "#4a4";

// my_context.fillRect(0, 20, 20, 200);


my_context.moveTo(0,20);
my_context.lineTo(w,20);

// my_context.stroke();



/*
my_context.font = "bold 12px sans-serif";
my_context.fillText("hier bin ich", 30, 50);
*/

/* 
// eine Schleife mit vielen Linien - warum geht das nicht? 
for (var x = 0; x <= w; x += 25) {
    my_context.moveTo(w / 2, h / 2);
    my_context.lineTo(x, h);

}
/*