Bonus: Waves


int i, w=1024, h=768, x, y, s=10;
float k, m, r, j=.01;

void setup() {
  size(w, h, P3D);
  noStroke();
}

void draw()
{
  background(#A4D6E8);
  lights();
  beginShape(8);
  for (i=0; i < w*h; i+=s)
  {
    x=i%w;
    y=i/w;     
    k=y+s;
    m=x+s;
    fill(100, 100, random(220,255), 200);
    vertex(x, n(y*w+x), y);
    vertex(m, n(y*w+m), y);
    vertex(m, n(k*w+m), k);
    vertex(m, n(k*w+m), k);
    vertex(x, n(k*w+x), k);
    vertex(x, n(y*w+x), y);
    i+=i%w==0?w*(s-1):0;
  }
  endShape();
  r-=j;
    fill(100, 100, random(220,255), 200);
  rect(0, width* .5, width, 400);
}
float n(float i) {
  return noise(i%w*j, i*j/w+r)*s*8+h/2;
}

Leave a Reply

Your email address will not be published. Required fields are marked *