• fullscreen
  • flare.pde
  • // Original particle code by Shining Particle by harukit
    // Created with Processing 68 alpha on September 11 , 2004
    // http://www.harukit.com 
    //Lens Flare
    //Modified by Owaun Scantlebury
    int pNum =4;
    
    float rr,gg,bb,dis;
    int gain = 5;
    float[] cc = new float[15];
    PImage pop,popc,pic;
    
    void keyPressed(){
      if (key=='1')   pic = loadImage("457.png");
      if (key=='2')   pic = loadImage("v.png");
    
      if (!online){
        if (key=='s')save("flare.png"); 
      }
    
    }
    void setup(){
      pic = loadImage("457.png");
    
      size(300,300,P3D);
    
    
      noStroke();
      pop = new PImage(width,height);
      popc = new PImage(width,height);
      loadPixels();
      pix = new color[width*height];
      background(0);
      for(int i=0;i<3;i++){
        cc[i]=random(40)+random(40)+random(40)+random(40)+random(40);
      }
    
    }
    public color[] pix;
    
    void draw(){
      if (!online )this.frame.setTitle("Framerate : "+str(frameRate)); 
    
      for(int y=0;y<height;y+=1){
        for(int x=0;x<width;x+=1){
          int pos=y*width+x;
          color col = pix[pos];
    
          rr = col >> 16 & 0xff;
          gg = col >> 8 & 0xff;
          bb = col  & 0xff;
    
          dis =dist(mouseX,mouseY,x,y)/82;
          rr += cc[0]/dis-gain;
          gg += cc[1]/dis-gain;
          bb += cc[2]/dis-gain;
    
    
          pixels[pos]=color(rr,gg,bb);
          pop.set(y,x,blendColor(color(rr,gg,bb),color(height-y,x,x-y),ADD));
        }
      }
    
    
      blend(pop,0,0,width,height,0,0,width,height,OVERLAY);
      blend(pic,0,0,width,height,0,0,width,height,OVERLAY);
    
    }
    
    void mousePressed(){
    
    }
    
    void mouseReleased(){
      for(int i=0;i<3;i++){
        cc[i]=random(40)+random(40)+random(40)+random(40)+random(40);
      }
    
    }
    public float xpos,ypos,del;
    
    
    
    
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    Owaun Scantlebury

    Lens Flare

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

    Original particle code by harukit
    Awesome piece of code!

    Press '1' to load image 1
    Press '2' to load image 2
    Click the mouse to change bulb colour

    Emmanuel Tabarly
    11 Mar 2010
    niiiice!
    Thanks Emmanuel!
    Antoine Bonnin
    17 Mar 2010
    Beautiful, love the transitions.
    Thank Antoine. That's exactly what I am trying to achieve, when transitioning from one point to the next.
    Ale
    29 Jun 2012
    Quite neat!
    Regards!
    Beautiful!
    Thanks a lot to Ale and Pawel!
    rajeshm101
    7 Sep 2013
    brilliant!
    You need to login/register to comment.