Week 3 Tut­o­r­i­a­l

by Chris Green
    /** @peep sketchbook */
     
    float o = -20;
    boolean oDir = true;
     
    void setup(){
      size(500,500);
      background(70);
      fill(255,6,100);
    }
     
    void draw(){
      background(70);
      if(o>=20){oDir=false;}
      if(o<=-20){oDir=true;}
      if(oDir==true){o+=.2;}
      if(oDir==false){o-=.2;}
        for(int y = 50; y<=450; y+=50){
          beginShape();
          vertex(0,y);
          float a = 0.0;
          float inc = TWO_PI/100.0;
     
          for(int i =0;i<=500;i++){
            if(y/10==10 || y/10==20 || y/10==30 || y/10==40 || y/10==50){
            vertex(i,y+sin(a)*o*a*.05);
            }else{
            vertex(map(i, 0, 500, 500, 0),y+sin(a)*o*a*.05);
            }
            a = a + inc;
          }
          endShape(CLOSE);
        }
    }

    Comments

    Nobody has said anything yet.