var canvas = document.getElementById('canvas'); var viewport = document.getElementById('view'); window.addEventListener('mousemove', function(e){ var x = -1*(e.clientX/window.innerWidth*0.1)*180; var y = 1*(e.clientY/window.innerHeight*0.1)*180; var t = " rotateX( "+x+"deg) rotateY("+y+"deg) "; canvas.style.webkitTransform = t; canvas.style.MozTransform = t; canvas.style.oTransform = t; }); generate(); function generate(){ var jmax=20; for(var j=0;j