xxxxxxxxxx
let gridSize;
let noiseScale;
const colorPalettes = [
[
[44, 123, 182],
[171, 217, 233],
[255, 255, 191],
[253, 174, 97],
[215, 25, 28],
],
[
[255, 111, 97],
[255, 173, 61],
[255, 219, 88],
[144, 190, 109],
[64, 89, 107],
],
[
[43, 45, 66],
[144, 26, 36],
[234, 46, 75],
[248, 202, 0],
[139, 195, 74],
],
[
[254, 67, 101],
[252, 157, 154],
[249, 205, 173],
[200, 230, 201],
[131, 175, 155],
],
[
[166, 223, 32],
[202, 211, 52],
[233, 255, 63],
[244, 202, 110],
[255, 140, 0],
],
];
const backgroundColors = [
[40, 40, 60],
[30, 30, 50],
[60, 60, 80],
[0, 0, 0],
];
function setup() {
gridSize = random(3, 10);
noiseScale = random(0.001, 0.02);
createCanvas(800, 800);
noiseDetail(8, 0.5);
}
function draw() {
const chosenBackgroundColor = backgroundColors[floor(random(backgroundColors.length))];
background(chosenBackgroundColor);
const colorPalette = colorPalettes[floor(random(colorPalettes.length))];
for (let y = gridSize; y < height; y += gridSize) {
for (let x = gridSize; x < width; x += gridSize) {
const noiseValue = noise(x * noiseScale, y * noiseScale);
const rSize = map(noiseValue, 0, 1, 2, 10);
const colorIndex = floor(map(noiseValue, 0, 1, 0, colorPalette.length));
const chosenColor = colorPalette[colorIndex];
stroke(chosenColor);
const lineWidth = map(noiseValue, 0, 1, 0.25, 2);
strokeWeight(lineWidth);
const angle = map(noiseValue, 0, 1, 0, TWO_PI);
const r = rSize;
const newX = x + cos(angle) * r;
const newY = y + sin(angle) * r;
line(x, y, newX, newY);
}
}
noLoop();
}