Replaced requestAnimationFrame with setInterval

This commit is contained in:
Uwe Oestermeier 2023-07-20 14:50:48 +02:00
parent 97fb30d741
commit 47992755e2
1 changed files with 4 additions and 5 deletions

View File

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