Joyful Light Drawer

//Joyful Light Drawer
//Derived from "Experiment in Abstract Shading" code.
//A lissajous curve modified to respond to mouseX, mouseY

float t = 0.2;
float spX, spY;

float stopVal;

int myFill;
//color lookup array
color[] colors = new color[5];


//how many circles to use when drawing
int count = 100;

void setup(){
  frameRate(15);
  size(500,500);
  smooth();
  stopValSet();
  myFill = 0;
  //the colors to be used
  colors[0] = #DAF799;
  colors[1] = #5FFAC6;
  colors[2] = #394541;
  colors[3] = #C45923;
  colors[4] = #F55302;
  
  background(255);
}

void draw(){
     // change the background color every 100 frames
     if(frameCount%100==0){
       switchColor();
     }
       fill(myFill,10);

       strokeWeight(20);
       rect(0,0,width,height);
       
       strokeWeight(5);
    
    //create a lissajous curve

    for (int i = 0; i< count; i++){ 
     

    
     spX = (t* mouseX*width) * 0.000001;
     spY = (t* mouseY*width) * 0.000001;
     spX = (width/2)*sin(spX);
     spY = (height/2)*cos(spY);



     stroke(colors[floor(random(colors.length))]);

     strokeWeight(5);

     point(spX + width/2 , spY + height/2);
     t += .1;

    }

    //reset theta if it is greater than stopVal
    if(t > stopVal){
      t = 0.1;

    }  

    

}

void switchColor(){
  if (myFill == 0){
    myFill = 255;
  } else {
    myFill = 0;
  }
}

void stopValSet(){
  stopVal = 50000;
}

Stare Long

// Sketch2
// CONTROLS:
// Click on the canvas to pause/unpause
// r = saves the current frame
// any other key while paused = step forward one frame

// This runs through draw to create a canvas filled with little shape. 
// I swear I see things if I stare at this long enough.


float shapeSize;
PShape oblong;
boolean pause;

void setup()

{
  size(500, 500);

  background(0);  
  frameRate(15);
  oblong = loadShape("wave.svg");
  oblong.disableStyle();


  noStroke();
  smooth();

}

void draw()
{
  // cycle through the vertical
  for (float x = 0; x < height; x+=shapeSize){
    // then the horizontal
    for ( float y = 0; y < width; y+=shapeSize ){
      
      // set the size of the shape
      shapeSize = random(1,25);
      
      // randomly select the color to fill the shape
      switch(floor(random(3))){
      case 0:
        fill(random(255),random(255),random(255));
        break;
      case 1:
        fill(0);
        break;
      case 2:
        fill(255);
        break;
      }

      // draw the shape
      shape(oblong, x, y, shapeSize, shapeSize);

    }
  }

}

void keyPressed(){
  if(key=='r'){
    saveFrame();
  }
  else{
    redraw();
  }
}


void mouseClicked(){
  if(pause){
    loop();
  } 
  else {
    noLoop();
  }
  pause = !pause;
}