Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

92
Visualizações
how do i create a program to loop through videos in p5.js

I am pretty new to coding, I am trying to apply different seriously.js effects on different arrays of videos, I am not even able to make the program loop through the videos in the array

Here is the work https://editor.p5js.org/ogierpaul/sketches/EeYFA5Vq_

let vid1= 'footb1.mp4';
let vid2= 'footb3.mp4';
let vid3= 'futball1.mp4';

b = [];
b = [vid1,vid2,vid3];

function preload() {
  for (var j = 0; j < b.length; j++){
    q = createVideo(b[j]);
  }
}

function setup() {
  createCanvas(640,480, WEBGL);
}

function draw() {
  background(220);
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It looks like the fundamental thing you're misunderstanding here is how to add items to an array:

let vid1= 'footb1.mp4';
let vid2= 'footb3.mp4';
let vid3= 'futball1.mp4';

// I think you probably meant to declare q here not b
let q = []; // previously: b = [];
let b = [vid1,vid2,vid3];

function preload() {
  for (var j = 0; j < b.length; j++){
    // as you create each new video you need to add it to the q array
    // you can do this using the push() function or using the index operator
    q[j] = createVideo(b[j]);
    // q.push(createVideo(b[j])); // this would also work
    // What you had would not work: q = createVideo(b[j]);
    // because it would replace the array initially stored in the variable q with
    // a single video
  }
}

function setup() {
  createCanvas(640,480, WEBGL);
}

function draw() {
  background(220);
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda