キャンバスで遊び中 - 砂嵐
キャンバス楽しい!
function rand256() { return Math.floor(Math.random() * 256); } function rand_graycolor() { var c = rand256(); return "rgb(" + c + "," + c + "," + c + ")"; } var canvas = document.body.appendChild(document.createElement('canvas')); canvas.width = 320; canvas.height = 240; var ctx = canvas.getContext('2d'); for( var y = 0; y < 240; y ++ ) { for( var x = 0; x < 320; x ++ ) { ctx.fillStyle = rand_graycolor(); ctx.fillRect(x, y, 1, 1); } }