xxxxxxxxxx
49
function setup() {
createCanvas(720, 720);
noLoop();
}
function draw() {
// Old beige paper-like background with grain
background('#FFF9E6');
//applyGrain(1.2, 1.0, 70); // Adjust parameters for the grain intensity
translate(width / 2, height / 2);
noFill();
for (let i = 0; i < 360; i += 10) {
let x = cos(radians(i)) * 130;
let y = sin(radians(i)) * 130;
// Adding noise for a paper-like grain effect
x += map(noise(i * 3, frameCount * 0.5), 0, 3, -25, 13);
y += map(noise(i * 13, frameCount * 12), 0, 1, -20, 15);
push();
translate(x, y);
stroke(0,150);
strokeWeight(random(1,1.8));
rotate(radians(i));
let circleSize = random(2);
ellipse(0, 0, circleSize, circleSize);
rect(0, 0, 50, 80);
pop();
}
}
// Function to apply grain texture to the background
function applyGrain(scaleX, scaleY, intensity) {
loadPixels();
for (let x = 0; x < width; x++) {
for (let y = 0; y < height; y++) {
let index = (x + y * width) * 4;
let noiseValue = noise(x * scaleX, y * scaleY) * intensity;
pixels[index] += noiseValue;
pixels[index + 1] += noiseValue;
pixels[index + 2] += noiseValue;
}
}
updatePixels();
}