Skip to content

Instantly share code, notes, and snippets.

@jmpinit
Created January 8, 2014 06:53
Show Gist options
  • Save jmpinit/8312837 to your computer and use it in GitHub Desktop.
Save jmpinit/8312837 to your computer and use it in GitHub Desktop.
(function() {
if(!document.time) document.time = 0;
document.time++;
var t = document.time;
for(var i = 0; i < sound.length; i++) {
sound[i] = (t*(((t>>12)|(t>>8))&(63&(t>>4))))/0xff % 1;
t++;
}
document.time = t;
var rand = function() { return Math.floor(Math.random()*255); }
var r = rand();
var g = rand();
var b = rand();
//ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.strokeStyle = "rgb("+r+", "+g+", "+b+");";
ctx.fillStyle = "rgb("+r+", "+g+", "+b+");";
ctx.beginPath();
ctx.moveTo(0, canvas.height/2);
for(var x = 0; x < canvas.width; x++) {
var k = sound.length * (x / canvas.width);
ctx.lineTo(x, canvas.height - (canvas.height/2 + sound[k]*canvas.height/2));
}
ctx.fill();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment