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
*/
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()
}