xxxxxxxxxx
let width = 400;
let height = 400;
let count = 0;
// 背景のノイズのパラメータ
var noiseVal = 30; // ノイズ
var zseed = [0, 7000]; // ノイズのシード値を固定
function setup() {
createCanvas(width, height);
background("#2f4f4f");
}
function draw() {
count++;
if(count % 10 > 0) return;
for (var y = -10; y < height; y += 40) {
for (var x = -10; x < width; x += 40){
// noiseValで割ってノイズの分布を引き延ばしている
let nx = (x + count) / noiseVal;
let ny = (y + count) / noiseVal;
let g = noise(nx, ny, zseed[0]) * 250;
let b = noise(nx, ny, zseed[1]) * 250;
noStroke()
fill(color(150, g, b));
rect(x, y, 50, 50);
fill(color(200, g+30, b+30));
rect(x, y, 30, 30);
// if(random(0, 10) < 3){
// }else{
// }
}
}
if (count > 6000) {
count = 0;
}
}