Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

211
Vistas
Better animation method than requestAnimationFrame for JavaScript?

Everywhere I see the advice to use requestAnimationFrame. What nobody tells you is that Chrome will throttle to 48 or 30fps based on your power plan, how many tabs you have open, and the phase of the moon, without notifying you in any way. It will do this regardless of the actual work load you’re doing.

For an actual animation, this is fine, if suboptimal. You use the elapsed time to generate a new frame of animation independent of frame rate.

But for something like an emulator it’s unacceptable.

I’m using SharedArrayBuffers, so I’ve already got the annoying headers included with my JavaScript that lets you use a few extra API’s. Is there any alternative to requestAnimationFrame or any way to force it to actually go at least 60Hz?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No there is no alternative, since the browser's paint job executes as many times as the requestAnimationFrame callback is called (when you keep scheduling it at each next call). So if you would do more frequent iterations somehow, it wouldn't help, as some of these changes wouldn't make it to the display.

If the issue is about timing, then realise that the callback is called with a timestamp, which can help you do realistic calculations. This doesn't change the varying frame rate, but at least allows you to know how much time has passed and base your calculations on that and not on the number of times that the callback is called.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda