Check this one out....this is neat....
function setup() {
createCanvas(800, 800);
noLoop();
colorMode(HSB, 360, 100, 100, 100); // Using vibrant colors
drawArtwork();
}
function drawArtwork() {
// Draw the main square
let squareSize = 700;
let squareColor = color(random(360), 80, 90, 100);
fill(squareColor);
noStroke();
rectMode(CENTER);
rect(width / 2, height / 2, squareSize, squareSize);
// Determine the pattern type and draw lines
let patternType = random(['straightLines', 'circularPattern']);
drawLines(width / 2, height / 2, squareSize, patternType);
// Add creative elements based on the pattern type
if (patternType === 'circularPattern') {
drawCircularElements(width / 2, height / 2, squareSize);
} else {
drawStraightLineElements(width / 2, height / 2, squareSize);
}
}
function drawLines(x, y, size, patternType) {
strokeWeight(1);
let numLines = 2500; // Half the previous number of lines
for (let i = 0; i < numLines; i ) {
let x1, y1, x2, y2;
if (patternType === 'circularPattern') {
// Lines that form a circular pattern
let angle = random(TWO_PI);
let radius = random(size / 4);
x1 = x cos(angle) * radius;
y1 = y sin(angle) * radius;
x2 = x cos(angle PI) * radius;
y2 = y sin(angle PI) * radius;
} else {
// Straight lines
x1 = random(x - size / 2, x size / 2);
y1 = random(y - size / 2, y size / 2);
x2 = random(x - size / 2, x size / 2);
y2 = random(y - size / 2, y size / 2);
}
stroke(color(random(360), 80, 90, 100));
line(x1, y1, x2, y2);
}
}
function drawCircularElements(x, y, size) {
// Draw elements that complement the circular pattern
fill(0);
noStroke();
ellipse(x, y, size / 5, size / 5); // Central circle
}
function drawStraightLineElements(x, y, size) {
// Draw elements that complement the straight line pattern
let numShapes = 100;
for (let i = 0; i < numShapes; i ) {
fill(random(360), 100, 100);
noStroke();
let shapeSize = random(10, 30);
ellipse(random(x - size / 2, x size / 2), random(y - size / 2, y size / 2), shapeSize, shapeSize);
}
}