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

133
Vistas
Javascript how to defer active script

I have a THREE.js animation loop:

function animation() {
    //Do stuff at 120fps
}
renderer.setAnimationLoop( animation );

I also have a large For loop:

for (var i = 0; i < 100; i++) {
    for (var j = 0; j < 100; j++) {
        //Do stuff with i and j
    }
}

The for loop takes ~50ms to execute. How would I be able to partially defer execution of the for statement, prefering the animation loop, so that the animation loop does not freeze for the execution time of the for loop? Moving the for loop to a webworker is not acceptable, although the animation loop fps dropping is acceptable, as long as it is not completely frozen. Note: I have tried making the for loop async using setTimeout, this did not work. I am not using any other libraries besides THREE.js

about 4 years ago · Juan Pablo Isaza
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