xxxxxxxxxx
function setup() {
createCanvas(800, 200);
background(255);
// Define the colors for the brush strokes
let colors = ['#FFC300', '#C70039', '#900C3F', '#581845', '#C70039', '#FFFF', '#00008B', '#006400'];
let numStrokes = 35000;
let strokeLength = 10;
let angleSegments = 8;
// Draw the brush strokes
for (let i = 0; i < numStrokes; i++) {
let x, y, angle;
let color = colors[i % colors.length];
let segmentIndex = floor(i / (numStrokes / angleSegments));
if (segmentIndex === 0) {
// First segment: strokes at 45 degrees down
x = random(width / 4);
y = random(height);
angle = radians(45);
} else if (segmentIndex === 1) {
// Second segment: strokes at -45 degrees
x = random(width / 4, width / 2);
y = random(height / 2);
angle = radians(-45);
} else if (segmentIndex === 2) {
// Third segment: strokes parallel to x
x = random(width / 2, width * 3 / 4);
y = random(height / 2);
angle = 0;
} else if (segmentIndex === 3) {
// Fourth segment: strokes parallel to y
x = random(width * 3 / 4, width);
y = random(height / 2, height);
angle = HALF_PI;
} else if (segmentIndex === 4) {
// Fifth segment: strokes at 45 degrees down
x = random(width / 4);
y = random(height / 2);
angle = radians(45);
} else if (segmentIndex === 5) {
// Sixth segment: strokes at -45 degrees
x = random(width / 4, width / 2);
y = random(height / 2, height);
angle = radians(-45);
} else if (segmentIndex === 6) {
// Seventh segment: strokes parallel to x
x = random(width / 2, width * 3 / 4);
y = random(height / 2, height);
angle = 0;
} else {
// Eighth segment: strokes parallel to y
x = random(width * 3 / 4, width);
y = random(height / 2);
angle = HALF_PI;
}
drawBrushStroke(x, y, strokeLength, angle, color);
}
}
function drawBrushStroke(x, y, length, angle, color) {
push();
translate(x, y);
rotate(angle);
stroke(color);
strokeWeight(2);
line(-length / 2, 0, length / 2, 0);
pop();
}