N
N
NQUAREx2022-04-21 17:47:42
JavaScript
NQUAREx, 2022-04-21 17:47:42

How to run animation for a specific time?

I have a main program loop looped with requestAnimationFrame How, for example, after a character crashes, disable collision for him for 3 seconds and blink at the same speed? In this case, the entire gameplay will continue to animate at a different speed.

How to run another one at a different speed and for a while during one animation?

I think the code is not required here, the standard animation loop using requestAnimationFrame:

function loop() {
    requestAnimationFrame(loop)

    let now = new Date().getTime(),
        dt = now - (time || now)

    time = now

    game.step(dt)
    game.render()
}

Thanks

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question