Need help from converting this p5.js/JavaScript program to Processing

ArrayList<Firework> fireworks = new ArrayList();
PVector gravity;

void setup() {
  fullScreen();
  gravity = new PVector(0, 0.2);
  stroke(255);
  strokeWeight(4);
  background(0);
}

void draw() {
  colorMode(RGB);
  background(0, 0, 0, 25);
  if (random(1) < 0.03) {
    fireworks.add(new Firework());
  }
  for (int i = fireworks.size()-1; i >= 0 ; i--) {
    fireworks.get(i).show();
    fireworks.get(i).update();
    if(fireworks.get(i).done()) {
      fireworks.remove(i);
    }
  }
}

// This class is just missing...
class Firework{
  Firework(){}
  void show(){}
  void update(){}
  boolean done(){return(false);}
}
// That is the bare minimum code needed to avoid syntax errors...

It’s boring without the Firework class. And you didn’t post that.

1 Like