xxxxxxxxxx
let font;
let bgColor;
let lineColor;
let textColor;
let fonts = ["Georgia", "Arial", "Courier New", "Verdana"];
function setup() {
createCanvas(800, 1000);
noLoop(); // Stops continuous drawing
}
function draw() {
generatePoster(); // Call the function to create a poster design
}
// Function to generate the poster design
function generatePoster() {
// Randomize background, line, and text colors
bgColor = color(random(0, 50), random(0, 50), random(0, 50));
lineColor = color(random(200, 255), random(200, 255), random(200, 255));
textColor = color(random(150, 255), random(150, 255), random(150, 255));
// Clear background
background(bgColor);
// Draw arrows with random stroke thickness
stroke(lineColor);
strokeWeight(random(8, 20));
line(width * 0.1, height * 0.2, width * 0.9, height * 0.8); // Diagonal arrow
line(width * 0.9, height * 0.2, width * 0.1, height * 0.8);
// Add "Social Distance" text with random font and size
fill(textColor);
noStroke();
textFont(random(fonts));
textSize(random(40, 60));
text("Social Distance", width * 0.1, height * 0.1);
// Add random notes
textSize(random(12, 20));
text("Maintain 1 meter / 3 feet distance.", width * 0.1, height * 0.9);
text("Day " + floor(random(1, 30)), width * 0.1, height * 0.15);
text("Quarantine", width * 0.7, height * 0.95);
// Save the design as a file
saveCanvas("poster_variation_" + floor(random(1000)), "jpg");
}
// Create three different variations
function keyPressed() {
if (key === 'n' || key === 'N') {
clear();
generatePoster();
}
}