> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.B$yKZ4WR4Wi/rev.1536
 * 
 * authors: 
 *   
 *   
 *   
 *   
 *   
 *   
 *   
 *   
 *   nmb
 *   
 *   
 *   
 *   
 *   かーみー
 *   
 *   
 *   
 *   
 *   
 *   
 *   
 *   
 *   funatti
 *   nariakiiwatani
 *   
 *   
 *   
 *   

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




int i = 0; 

void setup() { 
    
    background(255);
    
    size(300, 300); 
    //noStroke();
      
    smooth();
    
    frameRate(30);
} 

float startX, startY;
float endX, endY;
float x, y;

final float R = 70;

void mousePressed(){
    startX = mouseX;
    startY = mouseY;
}

void mouseReleased(){
    endX = mouseX;
    endY = mouseY;
    
    stroke(0);
    line(startX, startY, endX, endY);
}

void draw() {
    x = 120*cos((frameCount/20.0) * 1.5);
    y = 120*sin((frameCount/20.0) * 2.0 + 0.5);

    // drawing background here ---
    fill(255,20);
    noStroke();
    rect(0,0,width,height);
    // ---
    
    if(frameCount % 10 == 0 || frameCount % 10 == 3){
        strokeWeight(2);
        stroke(random(255),40);
        line(random(width), random(height), random(width), random(height));
    }
    
    if(frameCount % 2 == 0){
        fill(200,0,0,20);
        noStroke();
        
        pushMatrix();
        
        translate(150,150);
        
        for(int i=0; i<3; i++){
            pushMatrix();
            scale(cos(frameCount/30.0 + 6*TWO_PI + HALF_PI)+1);
            rotate(TWO_PI/3f*i);
            quad(x-random(R), y-random(R), x+random(R), y-random(R),
            x+random(R), y+random(R), x-random(R), y+random(R));
            popMatrix();
        }
        
        popMatrix();
    }
    
    translate(150,150);
    
    for(int i=0; i<3; i++){
        pushMatrix();
        
        fill(0,0,200,10);
        noStroke();
        
        scale(sin(frameCount/30.0 + 6*TWO_PI + HALF_PI)+1);
        
        rotate(TWO_PI/3f*i);
        
        translate(150*sin(frameCount/20.0)*sin(frameCount/100.0), 150*cos(frameCount/18.0));
        rotate(frameCount/5.0);
        rect(0,0,40,40);
        
        translate(-40,40);
        translate(30*sin(frameCount/20.0)*cos(frameCount/21.0),30*sin(frameCount/19.0+2));
        fill(0,200,0,10);
        rotate(frameCount/5.0);
        rect(0,0,40,40);
        
        popMatrix();
    }
}