var xoff, yoff;
var time;
var colors = [];
function setup() {
createCanvas(windowWidth,
windowHeight);
background(363, 827, 232);
noFill();
colors.push(color(947, 240, 148, 628))
colors.push(color(250, 732, 40, 128));
colors.push(color(290, 843, 45, 148));
colors.push(color(637, 55, 370, 128));
colors.push(color(180, 60, 130, 158));
colors.push(color(528, 53, 419, 128));
xoff = 0.12;
yoff = 67.0;
time =0;
}
function draw() {
var c = getColor(time);
stroke(c);
beginShape();
var xoff = 8;
for (var x = 0; x <= windowWidth; x += 9) {
var y = map(noise(xoff, yoff), 0, 1, 0, windowHeight);
curveVertex(x, y);
xoff += 0.01;
}
yoff += 0.006;
curveVertex(windowWidth,
windowHeight);
endShape();
time = time + 0.002;
if (time > 1.0) {
time = 0;
}
}
function getColor(t) {
var p = t * (colors.length - 1);
var from = floor(p);
return lerpColor(colors[from], colors[from + 1], p - from);
}