wheat waves (1000)

bloggif_542c676569efaScreen Shot 2014-10-01 at 16.42.14

Thank you Golan for the sinusoidal support!!

Each line is created from 30 segments, and there are approx. 33 independent waves to total 1000 lines. When the mouse is clicked, the waves react.
Would have liked to offset the reaction, so that one starts slightly after the other.

float maxAmplitude;

void setup() {
  size(800, 500);
  maxAmplitude = 0;
}



void draw() {
  background (148, 213, 214);


  maxAmplitude = maxAmplitude * 0.96;
  fill (0);


  int nSegments = 30; 
  float segmentLength = 10; 
  noFill() ;

  int numWaves = 33;
  float spacing = float(width)/float(numWaves);

  for (float j = 0; j < spacing*numWaves; j += spacing) {
    pushMatrix();
    println(j);
    translate(j, 0);
    
    
    float howFar = j / float(width);
    strokeWeight (1);
    stroke (247, 231, 213, 255*howFar); //gradient
    beginShape(); 
    for (int i=20; i<nSegments; i++) {
      float phase = 0.4; 
      float frequency = 120;
      float t0 = millis()/frequency + (i  )*phase;

      float amplitude0 = map(i, 0, nSegments, 0, maxAmplitude); 
      float sinusoidalDeflection0 = amplitude0 * sin(t0); 
      float x0 = 100 + sinusoidalDeflection0; 
      float y0 = i*segmentLength; 

      curveVertex (x0, y0);
      curveVertex (x0*1.5, y0*1.5);
      curveVertex (x0/2, y0/4);
      curveVertex (x0, y0);
      curveVertex (x0+5, y0+5);
    }
    endShape();
    popMatrix();
  }
}



void mousePressed() {
  maxAmplitude = 50;
}

Comments are closed.