Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!