> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.GCjQzkG0oPE/rev.274
 * 
 * authors: 
 *   Matt Perkins

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



// This sketch builds on a prior work, "she sells sea shells", created by Matt Perkins
// http://studio.sketchpad.cc/sp/pad/view/ro.9Gm8nzjKW0Lt1/rev.874



// Pressing Control-R will render this sketch.

//playing around with drawing

//use the left and right arrow keys to rotate the end point
//around the screen.

//mouse click clears

//move mouse to control origin point

int i = 0; 

int locationIndex=0;
int location2Index=0;

int BOXLENGTH = 600;

//doing this ahead of time speeds up run times.
PVector[] outboundLocations;

void setup() {  // this is run once.   

    outboundLocations = new PVector[BOXLENGTH * 4 ];
    
    for (int j=0;j<BOXLENGTH  ;j++)
    {
        outboundLocations[j] = new PVector(j,0);        
    }
    
    for (int j=0;j<BOXLENGTH  ;j++)
    {
        outboundLocations[j+BOXLENGTH  ] = new PVector(BOXLENGTH  ,j);        
    }
    
    for (int j=0;j<BOXLENGTH  ;j++)
    {
        outboundLocations[j+(BOXLENGTH*2)] = 
            new PVector(BOXLENGTH -j,BOXLENGTH  );        
    }
    
    for (int j=0;j<BOXLENGTH ;j++)
    {
        outboundLocations[j+(BOXLENGTH*3) ] = 
            new PVector(0,BOXLENGTH  -j);        
    }
        
    // set the background color
    background(23);
    
    // canvas size (Variable aren't evaluated. Integers only, please.)
    size(600, 600); //BOXLENGTH
      
    // smooth edges
    smooth();
    
    // limit the number of frames per second
    frameRate(30);
    
    // set the width of the line. 
    strokeWeight(2);
} 

void mousePressed() {
    background(23);    
}


void draw() {  // this is run repeatedly.  

    for(int k=0; k< 7; k++)
    {
    // set the color
    stroke(random(200,255), 255, 255, 25);
    
    // draw the line
    line(outboundLocations[locationIndex].x, 
        outboundLocations[locationIndex].y, 
        outboundLocations[location2Index].x,
        outboundLocations[location2Index].y);
    
    locationIndex = locationIndex + 10
    if (locationIndex >= outboundLocations.length)
        locationIndex = 0;
            
    location2Index = location2Index + ((int) random(10));
    if (location2Index >= outboundLocations.length)
        location2Index = 0;            
            
    // move over a pixel
    if (i < width) {
        i++;
    } else {
        i = 0; 
    }
    }
}