diff --git a/lib/scatter.js b/lib/scatter.js index 23a0242..91cc2b3 100644 --- a/lib/scatter.js +++ b/lib/scatter.js @@ -89,20 +89,19 @@ export class ResizeEvent extends BaseEvent { * @constructor */ -let ThrowableObjects = [] +let ThrowableObjects = new Set() let ThrowableRequests = null function stepThrowAnimation() { let clones = [...ThrowableObjects] - ThrowableObjects = [] + ThrowableObjects.clear() for(let obj of clones) { obj.animateThrow() } - requestAnimationFrame(stepThrowAnimation) } function startThrowableLoop() { - requestAnimationFrame(stepThrowAnimation) + setInterval(stepThrowAnimation, 33) return true } @@ -200,7 +199,7 @@ class Throwable { } recurseAnimateThrow() { - ThrowableObjects.push(this) + ThrowableObjects.add(this) if (ThrowableRequests == null) { ThrowableRequests = startThrowableLoop() }