Created
November 13, 2013 03:42
-
-
Save dialupnoises/7443333 to your computer and use it in GitHub Desktop.
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 canvas=document.createElement("canvas");canvas.id="bg-canvas";canvas.style.position="absolute";canvas.style.top="0";canvas.style.left="0";canvas.style["z-index"]="-1000";$(document).ready(function(){$(canvas).attr("width",$(document).width());$(canvas).attr("height",$(document).height());$("body").prepend(canvas);window.onresize=function(){$(canvas).attr("width",$(document).width());$(canvas).attr("height",$(document).height());drawCanvas()};drawCanvas()});function drawCanvas(){var b=canvas.getContext("2d");var d=Math.ceil($(canvas).width()/32);var a=$(canvas).height();var e=0.3;for(var c=0;c<32;++c){red=Math.sin(e*c+0)*127+128;green=Math.sin(e*c+2)*127+128;blue=Math.sin(e*c+4)*127+128;b.fillStyle=RGB2Color(red,green,blue);b.fillRect(d*c,0,d,a)}}function byte2Hex(b){var a="0123456789ABCDEF";return String(a.substr((b>>4)&15,1))+a.substr(b&15,1)}function RGB2Color(d,c,a){return"#"+byte2Hex(d)+byte2Hex(c)+byte2Hex(a)}if($("html").html().length>1000){setInterval(function(){$("body").children().each(function(){if($(this).prop("tagName")=="CANVAS"){return}$(this).css("opacity",Math.random())})},100)}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment