User:Yoana Buzova/canvas: Difference between revisions
Yoana Buzova (talk | contribs) No edit summary |
Yoana Buzova (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<canvas id="canvas" width=" | <canvas id="canvas" width="1150" height="400" showsrc> | ||
var p; | var p; | ||
i = 0; | i = 0; | ||
Line 7: | Line 7: | ||
p = c.getContext("2d"); | p = c.getContext("2d"); | ||
p.fillStyle = "#000000"; | p.fillStyle = "#000000"; | ||
p.fillRect( 0, 0, | p.fillRect( 0, 0, 1150, 400); | ||
p.fillStyle = "# | p.fillStyle = "#50EBEC"; | ||
drawBlocks(); | drawBlocks(); | ||
Line 14: | Line 14: | ||
p.fillRect(12*i, 0, 12, 400); | p.fillRect(12*i, 0, 12, 400); | ||
if(i*12> | if(i*12>1150){i=0;} | ||
i+=1; | i+=1; | ||
} | } |
Latest revision as of 16:30, 15 October 2012
<canvas id="canvas" width="1150" height="400" showsrc> var p; i = 0; function drawing(){
c = document.getElementById("canvas"); console.log("test"); p = c.getContext("2d"); p.fillStyle = "#000000"; p.fillRect( 0, 0, 1150, 400); p.fillStyle = "#50EBEC";
drawBlocks(); p.fillStyle = "#FFFF00"; p.fillRect(12*i, 0, 12, 400);
if(i*12>1150){i=0;} i+=1;
}
function draw(){
setInterval(function(){drawing()},50);
}
function drawBlocks(){
x = 0; counter = 0;
while (counter < 100) { p.fillRect(x, 0, 12 , 400); x = x + 25; counter = counter + 1;
}
} </canvas>