I want to do this same exact thing and needed help converting this p5.js program to processing code. I’m not sure how to do that. Any suggestions? Or if anyone knows where I can find a simpler fireworks example that I can using in processing that would help too. (I already tried open processing but a lot of the examples do not have comments so I’m not able to understand what they are coding and why its coded like that)
NOTE: This is just an example that I found.
Here is the code that I like, and I need help converting this so I can use that code in processing and modify the colors to what I prefer. Thanks.
var fireworks = [];
var gravity;
function setup() {
createCanvas(windowWidth, windowHeight);
gravity = createVector(0, 0.2);
stroke(255);
strokeWeight(4);
background(0);
}
function draw() {
colorMode(RGB);
background(0, 0, 0, 25);
if (random(1) < 0.03) {
fireworks.push(new Firework());
}
for (var i = fireworks.length -1; i >= 0 ; i--) {
fireworks[i].show();
fireworks[i].update();
if(fireworks[i].done()) {
fireworks.splice(i, 1);
}
}
console.log(fireworks.length);
}
Thanks a lot! I tried running it however and I’m getting a black screen, is it running on your end? I tried putting your code into just one tab and then I also tried putting the firework code is another still getting a black screen.
yes i did, not taking credit for it thats his code. i’m still new to processing so i was trying to follow along with his code and play around to learn how all the code works. thanks for link i guess i missed that