Update lines example to use onFrame.

This commit is contained in:
Jonathan Puckey 2011-04-26 15:51:56 +02:00
parent 520e540da7
commit 8f3e6f44a7

View file

@ -14,10 +14,10 @@
path.closed = true; path.closed = true;
} }
var position = document.bounds.center; var position = document.bounds.center,
var mousePos = position; mousePos = position,
var children = document.activeLayer.children; children = document.activeLayer.children,
var count = 0; count = 0;
function iterate() { function iterate() {
count++; count++;
@ -35,21 +35,12 @@
} }
} }
function onFrame() {
var lastRedraw = 0;
setInterval(draw, 30);
function draw() {
iterate(); iterate();
var now = new Date().getTime();
if(now - lastRedraw > 30) {
document.redraw();
lastRedraw = now;
}
} }
function onMouseMove(event) { function onMouseMove(event) {
iterate(); iterate();
lastRedraw = Date.now();
mousePos = event.point; mousePos = event.point;
} }
</script> </script>