• fullscreen
  • log_starburst_js.pde
  • // Log Starburst
    //  - Jim Bumgardner
    // using some ported code by Ryan Govostes
     
    float sineTable[];
    float dTable[];
    float aTable[];
     
    void setup() {
      size(600, 600);
      colorMode(RGB, 2);
      background(0);
      // noLoop();
     
      // precalculate 1 period of the sine wave (360 degrees)
      sineTable = new float[360];
      for (int i = 0; i < 360; i ++) sineTable[i] = sin(radians(i));
     
      // precalculate polar coords
      dTable = new float[width*height];
      aTable = new float[width*height];
      float  cx = width/2;
      float  cy = height/2;
      int n = 0;
      for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
          if (x == cx && y == cy) {
            dTable[n] = 0;
            aTable[n] = 0;
          }
          else {
            dTable[n] = log(dist(x,y,cx,cy));
            aTable[n] = atan2(y - cy, x - cx) + PI;
          }
          ++n;
        }
      }
    }
     
    int fc = 0;
     
    void draw() {
      float d,a;
      float r,g,b, n;
     
      int offset = 0;
     
      loadPixels();
      n = millis() * .0005; 
      for (int y = 0; y < height; y ++) {
        for (int x = 0; x < width; x ++) {
          d = dTable[offset];
          a = aTable[offset];     
          r = (sineTable[int(degrees(d*8+a)) % 360] * sineTable[int(degrees(a)*3) % 360]) + 1;
          g = (sineTable[359 - int(degrees(abs(d*8+a-PI/2-n))) % 360] * sineTable[int(degrees(a)*5) % 360]) + 1;
          b = (sineTable[int(degrees(d*8+a+PI/2+n)) % 360] * sineTable[int(degrees(a)*7) % 360]) + 1;
            
          // determine pixel color
          pixels[offset ++] = color(r,g,b);
           
        }
      }
      ++fc;
      
      updatePixels();
      // saveFrame();
    }
    
    
    

    code

    tweaks (0)

    about this sketch

    This sketch is running in HTML5 using Processingjs.

    license

    advertisement

    Jim Bumgardner (KrazyDad)

    log_starburst_js

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

    A port of a patch from my old "Pixel Magic" program, which started life as a Photoshop plug-in, in the early 90s.

    Similar code was used to produce this video:

    http://www.youtube.com/watch?v=ZbGLzAjDKeg

    One of a series of images I produced in the early 90s, originally in the 'C' language, as part of my 'Pixel Magic' project.
    Starkes
    7 Jul 2009
    whooooooooooaaaaaaaaaaaaaaa
    DeadDealer
    19 Aug 2009
    hmm, reminds me of the time i had a good old crt ... he didn't like magnets, because it looked like THIS when you applied it to the monitor ^_^
    Another sketch I have been looking all over the internet for!

    Thanks!!
    You need to login/register to comment.