Created
October 15, 2011 12:42
-
-
Save dexteryy/1289506 to your computer and use it in GitHub Desktop.
random bitmap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tmp = document.createElement('DIV'); | |
tmp.innerHTML = '<canvas width="512" height="512" style="position:fixed;top:10px;right:10px;z-index:99999;"></canvas>'; | |
var e = tmp.firstChild; | |
document.body.appendChild(e); | |
var ctx = e.getContext('2d'); | |
ctx.fillStyle = "#000"; | |
ctx.fillRect(0, 0, 512, 512); | |
ctx.fillStyle = "#fff"; | |
for (var y = 0, x; y < 512; y++) { | |
for (x = 0; x < 512; x++) { | |
if (Math.random() > 0.5) { | |
ctx.fillRect(x, y, 1, 1); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment