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

88
Vistas
Make slideshow/animation with multiple images

i know that there are question similar to this one, but my goal is different.

I have an array of Sceneobjects like this:

 const scene = {
      Id: Math.floor(Math.random() * 10000),
      JsonObj: canvas.getJsonObj(),
      image: this.editor?.export.toImage(),
      duration: 1000,
    };

And am using a library PikasoJS that alows me to export/import an image of a html div.

I put each image of div in scene object, and i want to display all these images in array scenes one by one automatically, and duration of scene is specified in duration field.

How can i implement something like this, i tried working with setInterval but it didn't work as i espected:

 const playScene = () => {
    const cpScenes = [...scenes];
    let i = 0;
    for(let i = 0;i < cpScenes.length;i++) {
      setTimeout(() => {
        let image = cpScenes[i].image;
        console.log("am runnig");
        this.editor.loadImage(image);
      }, cpScenes[i].duration);
    }
    clearTimeout();
  };

The way am thinking is that setTimeout should block execution of for loop and then executes it's code after specified time. But from what i noticed i was wrong.

This is my first time working with react and 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