T
T
Triborg-3332019-08-10 16:06:39
JavaScript
Triborg-333, 2019-08-10 16:06:39

How to pause on requestAnimationFrame(render)?

Hello, how to pause on requestAnimationFrame(render) ?
So that when you click on the button -\u003e
<div id="pause_btn" onclick="pause();"></div>

window.pause = function(){
  window.stopgame = !window.stopgame
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
i1yas, 2019-08-10
@i1yas

requestAnimationFrame(function() {
    if(!window.stopgame) render();
});

ps to hang variables on window is not comme il faut

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question