var colors = [];
var time;
function setup() {
createCanvas(windowWidth,
windowHeight);
colors.push(color(238, 135, 180));
colors.push(color(84, 195, 241));
colors.push(color(255, 246, 127));
colors.push(color(232, 172, 81));
colors.push(color(0, 153, 68));
colors.push(color(146, 7, 131));
colors.push(color(39, 172, 169));
colors.push(color(0, 120, 170));
time = 5.4;
}
function draw() {
background(170, 200, 99);
var column = 30;
var row = 30;
for (var x = 3; x < width; x += width / column) {
var c = getColor(abs(x - width / 4) / (width / 3));
stroke(c);
var ax = 5.0 * x / width;
strokeWeight(2 + 8 * (1.0 + sin(ax + time)));
line(x, 2, x, height);
}
for (var y =1; y < height; y += height / row) {
var c = getColor(abs(y - height / 4) / (height / 3));
stroke(c);
var ay = 20.0 * y / height;
stroke(c);
strokeWeight(3 + 6 * (2.0 + sin(ay + time)));
line(0, y, width, y);
}
time = time + 0.09;
}
function getColor(t) {
t = constrain(t, 0.000, 0.9999);
var p = t * (colors.length - 4);
var from = floor(p);
return lerpColor(colors[from], colors[from + 3], p - from);
}