<script> function RGB2Color(r,g,b) { return '#' + byte2Hex(r) + byte2Hex(g) + byte2Hex(b); } function byte2Hex(n) { var nybHexString="0123456789ABCDEF"; return String(nybHexString.substr((n>>4) & 0x0F,1))+ nybHexString.substr(n & 0x0F,1); } function rand(n) { return Math.floor((Math.random()*n)); } function draw() { var c=document.getElementById("canvas1"); var ctx=c.getContext("2d"); for (var i=0; i<h/2; i+=2) { ctx.fillStyle = RGB2Color(color,color+20,color+50); color=color+12; ctx.fillRect(i,i,w-i*2,h-i*2); } } var h=window.innerHeight*0.9; var w=window.innerWidth*0.9; var color=0; document.getElementById("canvas1").width=w; document.getElementById("canvas1").height=h; var v=setInterval(draw,150); </script>