xxxxxxxxxx
function setup() {
createCanvas(800, 800);
noLoop();
textAlign(CENTER, CENTER);
textFont('Arial');
textStyle(BOLD);
}
function draw() {
//canvas radial gradientrandom
let centerX = width / 2;
let centerY = height / 2;
let maxRadius = sqrt(sq(width) + sq(height)) / 2; // Diagonal of the canvas
let maxColorValue = 200; // Max color value for RGB
let colorStart = color(random(maxColorValue), random(maxColorValue), random(maxColorValue));
let colorEnd = color(random(maxColorValue), random(maxColorValue), random(maxColorValue));
// radial gradient
for (let r = maxRadius; r > 0; --r) {
let inter = map(r, 0, maxRadius, 0, 1);
let c = lerpColor(colorStart, colorEnd, inter);
fill(c);
noStroke();
ellipse(centerX, centerY, r * 2, r * 2);
}
// lines with random lengths and colors to cover the canvas
let numLines = 2000; // Increase number of lines
let angleStep = TWO_PI / numLines;
for (let i = 0; i < numLines; i++) {
let angle = i * angleStep;
let lineLength = random(0, maxRadius); // Start from the center
let lineWeight = random(1, 5);
let lineColor = color(random(maxColorValue), random(maxColorValue), random(maxColorValue));
let x1 = centerX;
let y1 = centerY;
let x2 = centerX + cos(angle) * lineLength;
let y2 = centerY + sin(angle) * lineLength;
strokeWeight(lineWeight);
stroke(lineColor);
line(x1, y1, x2, y2);
}
//random text elements "Aftermath"
let textSizeValue = random(48, 64); // Random font size
let textColor = color(random(255), random(255), random(255)); // Random text color
fill(textColor);
textSize(textSizeValue);
text('Aftermath', centerX, centerY); // text at the center
}
function keyPressed() {
if (key === 's' || key === 'S') {
saveCanvas('coverkapak', 'jpg');
}
}
function mousePressed() {
redraw();
}