xxxxxxxxxx
// generated using https://openprocessing.org/sketch/1224723
const hexPalette = ["#403c03", "#d2c843", "#43d279", "#4c43d2", "#fbf9dd"];
let palette;
function setup() {
createCanvas(1024, 1024);
colorMode(HSB, 360, 100, 100, 1.0);
palette = hexPalette.map((hex) => hexToHsb(hex));
}
function draw() {
const bg = palette[0];
const fg = palette[4];
background(bg);
const colors = palette.slice(1, 4);
const bandWidth = width / 2;
noStroke();
const n = 1;
for (let i = 1; i <= n; i++) {
let inc = 2;
let c = color(colors[0]);
let ni = 1;
let minY = height;
let maxY = 0;
let baseNoiseScale = 0.002 + (0.001 * (i / n));
for (let x = 0; x < width; x += inc) {
const nv = noise(x * baseNoiseScale);
let h = nv * height;
let d = 1;
if (h > maxY) maxY = h;
if (h < minY) minY = h;
if (random(1) > 0.5) {
h = height * noise(x * baseNoiseScale * 1.0011);
d = map(nv, 0, 1, 2, 4);
}
// color lines
c.setAlpha(map(nv, 0, 1, 0.5, 0.8));
fill(c);
rect(x, 0, inc / d, h);
// below the fold texture
if (i === 1) {
const bc = color(fg);
bc.setAlpha(map(nv, 0, 1, 0.05, 0.1));
fill(bc);
const s = height - h; //(noise(x * 0.003) * (height * 0.03));
rect(x,
h,
inc / random(1, 4),
s);
}
const amt = (x - (bandWidth * (ni - 1))) / bandWidth;
c = lerpColor(colors[ni - 1], colors[ni], amt / random(1.1, 2));
if (amt >= 1) {
ni = ni + 1;
}
}
}
noLoop();
}