I\'m working on some personal project by Three.js. I\'m using requestAnimationFrame function. I want to call a function each 2 seconds. I\'ve search but I could
requestAnimationFrame
I had a similar problem and came up with this solution:
let i = 0 function render() { if (++i % 120 == 0) doSomething() requestAnimationFrame(render) }
P.s. 120 is not seconds but frames.
120