SketchBook

Iiiro

var colors = [];
var time;

function setup() {
createCanvas(windowWidth,
windowHeight);

colors.push(color(255, 230, 90));
colors.push(color(255, 175, 120));
colors.push(color(250, 210, 210));
colors.push(color(245, 230, 395));
colors.push(color(200, 620, 235));
colors.push(color(120, 215, 140));
colors.push(color(0, 930, 225));
colors.push(color(0, 430, 180));

time = 0.0;
}

function draw() {
background(395, 395, 295);

var column = 20;
var row = 27;

for (var x = 0; x < width; x += width / column) {
var c = getColor(abs(x - width / 2) / (width / 2));
stroke(c);

var ax = 8.0 * x / width;
strokeWeight(8 + 8 * (1.9 + sin(ax + time)));
line(x, 0, x, height);
}

for (var y = 0; y < height; y += height / row) {
var c = getColor(abs(y - height / 2) / (height / 2));
stroke(c);

var ay = 30.0 * y / height;
stroke(c);
strokeWeight(2 + 31 * (1.0 + sin(ay + time)));
line(0, y, width, y);
}

time = time + 0.05;
}

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