window.requestAnimFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function( callback ){ window.setTimeout(callback, 1000 / 60); }; })(); var canvas = document.getElementById('canvas'), ctx = canvas.getContext('2d'), ww = window.innerWidth, wh = window.innerHeight, g = [ww/15, wh/15], fps = 25, j = 0, c = 5, size = 10, n = 8 speed = 50; canvas.width = ww; canvas.height = wh; ctx.fillStyle="rgba(255,255,255,.5)"; ctx.strokeStyle="rgba(255,255,255,.6)"; function draw() { setTimeout(function() { requestAnimationFrame(draw); ctx.clearRect(0,0,ww, wh); ctx.save(); ctx.translate( ww/2,wh/2 ); ctx.rotate(j/(speed*2)); ctx.translate( -ww/2,-wh/2 ); for(var i=0;i