xxxxxxxxxx
48
let grid;
let palette = ["#ff71ce", "#01cdfe", "#05ffa1", "#b967ff", "#fffb96"];
function setup() {
createCanvas(100, 100);
background(20);
noiseDetail(4, 0.25);
// grid = [];
// for (let r = 0; r < height; r++) {
// grid[r] = [];
// for (let c = 0; c < width; c++) {
// let n = noise(c * 0.01, r * 0.01);
// // grid[r][c] = int(map(n, 0.0, 1.0, 0, palette.length - 1));
// // grid[r][c] = constrain(grid[r][c], 0, palette.length - 1);
// // stroke(color(palette[grid[r][c]]))
// // point(c, r);
// // grid[]
// if (n < 0.2) stroke(color(0))
// else stroke(color(255,0,255))
// point(c,r);
// }
// }
// console.log("done");
// noLoop();
// }
}
let zoff = 0;
function draw() {
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let n = noise(x * 0.01, y * 0.01, zoff * 0.01);
let idx = int(map(n, 0.0, 1.0, 0, palette.length - 1));
idx = constrain(idx, 0, palette.length - 1);
stroke(palette[idx])
point(x, y);
}
}
zoff++;
}