• fullscreen
  • Jellyfish.pde
  • class.pde
  • Furniture object1, object2, object3;
    
    void setup(){
      size(500,500);
      smooth();
      object1 = new Furniture();
      object2 = new Furniture();
      object3 = new Furniture();
    }
    
    void draw(){
      
      background(255);
      
      object1.display();
      object2.display();
      object3.display();
      
       object1.update();
       object2.update();
       object3.update();
    }
    
    
    class Furniture {
      //data
      float x, y;
      float xspeed, yspeed;
      float r;
      float a,b,c;
      int diameter = 20;
    
      //constructor
      Furniture(){
          x = random(width);
        y = random(height);
        xspeed = random(-5, 5);
        yspeed = random(-5, 5);
        r = 10;
        a = random(0,255);
        b = random(0,255);
        c = random(0,255);
    
    
    
    
    
    
      }
    
      void update() {
        x += xspeed;
        y += yspeed;
    
        //conditional
        if (( x > width) || (x<=0)) {
          xspeed *=-1;
        }
    
        if ((y>=height) || (y<=0)) {  
          yspeed *=-1;
        }
      }
    
    
     void display(){
       fill(a,b,c);
       ellipse(x+10,y+100, 12, 5);
       
       ellipse(x+20,y+10, 5, 10);
       
       ellipse(x+20,y+150, 2, 6);
       
       ellipse(x+20,y+250, 5, 5);
       
       ellipse(x+40,y+14, 5, 7);
       
       ellipse(x+40,y+50, 8, 6);
       
        ellipse(x+30,y+80, 5, 5);
       
       ellipse(x+60,y+20, 6, 1);
       
       ellipse(x+50,y+60, 6, 6);
       
       ellipse(x+30,y+70, 5, 5);
       
       ellipse(x+60,y+10, 5, 10);
       
       ellipse(x+60,y+80, 10, 6);
       
         noStroke();
      
      fill(c,a,b,100); 
      arc(x+30, y, x+50, y,PI, TWO_PI);
      
      fill(a,b,c,20);
      arc(x+40, y, x+45, y,PI, TWO_PI);
      
      fill(b,c,a,10);
      arc(x+20, y, x+25, y,PI, TWO_PI);
       
       
         noFill();
         color(250,0,0,100);
        stroke(0.25); 
         
      arc(x+45, y, x+50, y,PI, TWO_PI-PI/2);
      arc(x+30, y, x+50, y,PI, TWO_PI-PI/2);
    
      
       arc(x+45, y, x+50, y,TWO_PI-PI/2, TWO_PI);
       arc(x+50, y, x+50, y,TWO_PI-PI/2, TWO_PI);
      
       noStroke();
      fill(a,c,b);
      rect(x+10,y,3,160);
       
      rect(x+20,y,1.5,280);
      rect(x+30,y,1.5,100);
       
      rect(x+40,y,2,140);
       
       
      rect(x+50,y,1,195);
       
      rect(x+60,y,2.5,140);
       
    //  fill(a,b,c);
    // quad(x+30,y+86,x+91,y+86,x+85,y+115,x+38,y+115);
    //   
    //  fill(205,67,25);
    //  quad(x+38,y+124, x+85,y+124, x+99,y+150,x+40,y+150);
    
    
    
    }
    
      
    }
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    Renee Kim

    Jellyfish

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

    You need to login/register to comment.