LP x GenNext Auction 2024. p5.js code:
const sW = 720
const sH = 940
let counter = 0; // Initialize a counter variable
let seed; // Declare a variable for the random seed
function setup() {
createCanvas(sW, sH);
noStroke();
background(0);
//seed = floor(random(1000)); // Set a random seed value
seed = 1960;
}
function draw() {
if (counter < 200) { // Check if the counter is less than 200
randomSeed(seed + counter); // Change the seed slightly for each rectangle
let r = random(255);
let g = random(255);
let b = random(255);
let alpha = random(200, 255);
let w = random(10, 100); // width of the rectangle
let h = random(10, 100); // height of the rectangle
fill(r, g, b, alpha);
rect(random(width), random(height), w, h);
/*
// Improve the visibility of the seed value on the screen
fill(0, 0, 0, 150); // Semi-transparent black background
rect(5, 10, 150, 20); // Adjust size as needed
fill(255); // White color for text
textSize(16); // Set text size
text(`Seed: ${seed}`, 10, 30); // Position the text at the top
*/
counter++; // Increment the counter
} else {
noLoop(); // Stop the draw loop after 200 iterations
}
}