xxxxxxxxxx
32
function setup() {
createCanvas(400, 400);
noLoop();
}
function draw() {
let noiseLevel = 255;
let noiseScale = 0.02;
let reflection = [];
background('blue');
for (let y = 0; y < height; y += 1) {
for (let x = 0; x < width/2; x += 1) {
// Scale input coordinates.
let nx = noiseScale * x;
let ny = noiseScale * y;
// Compute noise value.
let c = noiseLevel * noise(nx, ny);
// Render.
stroke(c);
reflection.push(c);
point(x, y);
}
for(let x = 0; x < width/2; x += 1) {
let c = reflection.pop();
stroke(c);
point(x+width/2, y);
}
}
}