• fullscreen
  • equilibrium.pde
  • particleHafiz.pde
  • subP.pde
  • import processing.opengl.*;
    
    
    
    particleHafiz pH[];
    
    void setup()
    {
      size(600,600,OPENGL);
      //noCursor();
      fill(255,0,0,50);
      smooth();
      pH=new particleHafiz[10*100];
    
      for(int i=0; i<pH.length; i++)
      {
        float val = random(10);
        
        if(val < 5)
        {
          pH[i]=new subP(i/5000.0,450,0,250);
    
        }
    
        else
        {
          stroke(255,0,255,50);
          pH[i]=new particleHafiz(i/5000.0,450,450);
        }
      }
    }
    
    void draw()
    {
      fill(0,3);
      noStroke();
      rect(0,0,width,height);
    
    
    
      for(int i=0; i<pH.length; i++) 
      {
        pH[i].calculation();
        pH[i].update();
        pH[i].display();
        
      }
    
    
    }
    
    
    
    
    
    
    
    class particleHafiz 
    {
      float id,x,y,xp,yp,sp,d;
    
      particleHafiz(float Hid,float dx,float dy) 
      {
        id=Hid;
        x=xp=dx;
        y=yp=dy;
        sp=random(2,7);
    
      }
    
    
    
      void calculation()
      {
        id+=0.0005;
        d=(noise(id,x/mouseX,y/mouseX)-0.5)*mouseY;  
    
        x+=cos(radians(d))*sp;
        y+=sin(radians(d))*sp;
      }
      
      void update()
      {
    
        if(x<-10) 
          x=xp=width+10;
    
        if(x>width+100)
          x=xp=-10;
    
        if(y<-10) 
          y=yp=height+10;
    
        if(y>height+10)
          y=yp=-10;
    
    
      }
    
      void display()
      {
        //stroke(10,0,20,90);
        stroke(255,0,255,90);
        line(xp,yp,x,y);
        xp=x;
        yp=y;
    
      }
    }
    
    
    
    
    
    
    class subP extends particleHafiz
    {
      float Blue;
    
      subP(float Hid,float dx,float dy,float b)
    
      {
        super (Hid,dx,dy);
        Blue = b;
      }
      
      
      void calculation()
      {
        id+=0.0005;
        d=(noise(id,x/mouseY,y/mouseY)-0.5)*mouseX;  
    
        x+=sin(radians(d))*sp;
        y+=cos(radians(d))*sp;
      }
      
      
      void update()
      {
        super.update();
      } 
      
      
    
      void display()
      {
        stroke(60,120,Blue,90);
        line(xp,yp,x,y);
        xp=x;
        yp=y;
    
      }
    
    }
    
    
    
    
    
    
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    muhammad hafiz wan rosli

    Equilibrium

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

    You need to login/register to comment.