SketchBook

初春

var cellX;
var cellY;
var time;
var colors = [];

function setup() {
createCanvas(windowWidth,
windowHeight);
background(400, 255, 255);
noStroke();

 colors.push(color(400, 100, 210));
 colors.push(color(402, 109, 207));
 colors.push(color(405, 100, 0));
 colors.push(color(409, 100, 236));
 colors.push(color(400, 100, 140));

cellX = 50;
cellY = 50;

 time = 0.001;
}

function draw() {
for (var y = 0; y < cellY; y = y + 1) {
for (var x = 0; x < cellX; x = x + 1) {
var val = noise(x / 100, y / 100, time);
var c = getColor(val);

var rectWidth = windowWidth / cellX;
var rectHeight = windowHeight / cellY;
var rectX = x * rectWidth;
var rectY = y * rectHeight;

fill(c);
rect(rectX, rectY, rectWidth, rectHeight);
}
}

time += 1;
}

function getColor(t) {
var p = t * (colors.length - 1);
var from = floor(p);
return lerpColor(colors[from], colors[from + 1], p - from);
}

Author: takamatsu