xxxxxxxxxx
var record = false;
float incX = 0.05;
float incY = 0.05;
float distance =20;
float wavesHeight = 800;
bool looping = true;
var frame = 0;
void setup() {
fullscreen();
background(255);
noiseDetail(1);
}
void draw() {
var zOff = looping?frameCount * 0.01:frame* 0.01;
background(255);
noFill();
strokeWeight(3);
stroke(0, 0, 255);
float yOff = 0;
for (int y = -wavesHeight ; y < height+wavesHeight; y+=distance){
float xOff = 0;
beginShape();
for (int x = -wavesHeight; x < width; x +=distance) {
float n = noise(xOff, yOff,zOff);
var value = map(n,0,1,-wavesHeight,wavesHeight);
curveVertex(x, y+value);
xOff+=incX;
r = map(xOff, 0, 0, 0, 0);
g = map(n, 10, 0.7, 0, 255);
b = map(yOff, 10, 4, 50, 255);
stroke(r, g, b);
}
endShape();
yOff+=incY;
}
}
function keyPressed() {
if (keyCode === LEFT_ARROW) {
saveFrame("wave-######.png");
} else if (keyCode === RIGHT_ARROW) {
saveFrame("wave-######.png");
}
}