• fullscreen
  • save.pde
  • smallsimplelineandsparkle.pde
  • void saveImage() {
      String fileName = timeStamp()+".jpeg";
      PImage imageSave = get(0,0,width,height);
      imageSave.save(fileName);
    }
    
    String timeStamp() {
     String timestamp = year()+"_"+month()+"_"+day()+"_"+minute()+"_"+second()+"_"+millis();
     return timestamp;
    }
    
    void setup(){
      size(800,500);
      background(255);
      colorMode(HSB, TWO_PI, 2, 1);
      
    smooth();}
      
      void draw(){
        
        //frameRate(60);
      
        line(pmouseX,pmouseY,mouseX,mouseY);
        stroke(255);
        strokeWeight(random(.5,1));
       
        
        if(mousePressed){
          line(pmouseX,pmouseY,mouseX,mouseY);
          
           strokeWeight(random(.5,30));
           stroke(0);
           strokeCap(SQUARE);
      }
      }
      void drawCircle (float x, float y, float radius, int num) {
      float r = random (255);
      float b = random (255);
      fill (r,0,10,170);
      ellipse (x, y, radius, radius);
      if (num > 1) {
        num = num - 1;
        for (int i = 0; i < 4; i++) {
          float a = random (0, TWO_PI);
          float newx = x + cos(a) * 100.0*i;
          float newy = y + sin(a) * 100.0*i;
          drawCircle (newx, newy, radius/2, num);
        }
      }
    
    }
        void keyPressed() {
      if(key=='s'){ 
        saveImage();}
    
       if(key==' ') {
        
        rect(0,0,width,height);
        fill(255);
        }
        if(key=='b') {
        filter(BLUR);
        }
        if(key=='c'){
        drawCircle (width/2,height/2,mouseX,8);
       }   
        }
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    Justin Lincoln prof+

    squaredlineswithsparkle

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    c allows for recursive sparkle( in white)
    b allows for blur
    s allows for save as jpeg

    You need to login/register to comment.