xxxxxxxxxx
/**
* noise() で遊ぼう! 前編
* グラフで見てみる 2次元ノイズ
*
* @author @deconbatch
* @version 0.1
* @license CC0 1.0 https://creativecommons.org/publicdomain/zero/1.0/deed.ja
* 2020.10.31
*/
function setup() {
createCanvas(640, 320);
colorMode(HSB, 360.0, 100.0, 100.0, 100.0);
noLoop();
background(0.0, 0.0, 90.0, 100.0);
noFill();
stroke(0.0, 0.0, 0.0, 100.0);
strokeWeight(2.0);
}
function draw() {
const divX = 50;
const divY = 5;
const w = width / divX;
const h = height / divY;
for (let j = 0; j < divY; j++) {
beginShape();
for (let i = 0; i < divX; i++) {
let x = i * w;
let y = noise(i, j) * 100 + j * h;
vertex(x, y);
}
endShape();
}
}