• fullscreen
  • week4_arrays.pde
  • Fire [] firework = new Fire [15];
    
    
    
    void setup(){
      
      size(500,500);
      smooth();
      for (int i=0; i<firework.length;i++){
        firework[i]=new Fire();
      }
      
      background(0);
    }
    
    void draw(){
     background(0);
     for(int i=0; i<firework.length; i++){
     
     firework[i].click();
     }
    }
    
    class Fire{
        float x;
        float y;
        float r;
        float g;
        float b;
        float sizeA;
        float sizeB;
        float n;
        float px;
        float py;
        float v;
        
      Fire(){
        
      }
      
      void click(){
          
          x=mouseX-random(-110,110);
          y=mouseY-random(-110,110);
          r=random(210,255);
          g=random(210,255);
          b=random(210,255);
          v=random(50,200);
          sizeA=random(3,6);
          sizeB=random(10,60);
          n=random(0,1.5);
          
          fill(r,g,b,v);
          noStroke();
          ellipse(mouseX,mouseY,sizeB,sizeB);
          strokeWeight(n);
          stroke(r,g,b,v);
          line(mouseX,mouseY,x,y);
          ellipse (x,y,sizeA,sizeA);
          
        }
    }
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    ianchristopherieong

    week 4 arrays

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

    testing version of assignment 1

    You need to login/register to comment.