Use the experimental Event.requestAnimationFrame() rather than setInterval().

This commit is contained in:
Jürg Lehni 2011-03-14 22:21:27 +01:00
parent 4ec8847859
commit 7e46eeabc4

View file

@ -20,7 +20,7 @@
path.scale(scale); path.scale(scale);
new PlacedSymbol(path); new PlacedSymbol(path);
} }
setInterval(draw, 30); // setInterval(draw, 30);
function onMouseDrag(event) { function onMouseDrag(event) {
mousePoint = event.point; mousePoint = event.point;
@ -38,7 +38,9 @@
item.translate(delta); item.translate(delta);
} }
document.redraw(); document.redraw();
Event.requestAnimationFrame(draw, document.canvas);
} }
Event.requestAnimationFrame(draw, document.canvas);
</script> </script>
</head> </head>
<body> <body>