青い絵の具を水に入れた時のやつ
var xoff, yoff;
var time;
var colors = [];
function setup() {
createCanvas(windowWidth,
windowHeight);
background(0, 0, 0);
noFill();
colors.push(color(29, 32, 132, 150))
colors.push(color(77, 67, 152, 150))
colors.push(color(27, 28, 128, 150));
colors.push(color(24, 24, 120, 150));
colors.push(color(121, 107, 175, 150));
colors.push(color(93, 80, 153, 150));
xoff = 0.0;
yoff = 0.0;
time = 0;
}
function draw() {
var c = getColor(time);
stroke(c);
beginShape();
var xoff = 0;
for (var x = 0; x <= windowWidth; x += 5) {
var y = map(noise(xoff, yoff), 0, 1, 0, windowHeight);
curveVertex(x, y);
xoff += 0.03;
}
yoff += 0.002;
curveVertex(windowWidth,
windowHeight);
endShape();
time = time + 0.0001;
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);
}