User Tools

Site Tools


tracy444a:evil_but_cool_version

Evil But Cool Version of Sierpinski Carpet inspired fractal

Fractal!
      Cool Fractal!

Here is the Processing code to make the Evil But COOL fractal:

import ddf.minim.*;
import ddf.minim.signals.*;
 
Minim minim;
AudioOutput out;
SineWave sine;
 
PImage flower;
float count;
float number;
float num;
float sz;
int s;
int b;
 
 
 
void setup()
{
  count=0;
  number=1;
  sz=1;
  num=2;
  s=0;
  b=99;
  flower=loadImage("pink_flower.jpg");
  size(flower.width,flower.height);
 
  minim = new Minim(this);
  // this gets a stereo output
  out = minim.getLineOut();
 
  //waveform = new WaveformRenderer();
  // see the example Recordable >> addListener for more about this
//  out.addListener(waveform);
 
  // see the example AudioOutput >> SineWaveSignal for more about this
  sine = new SineWave(220, 0.5, out.sampleRate());
  // add the signal to out
  out.addSignal(sine);
}
 
void mousePressed() {
  count++;
  s=89;
  b=96;
  number=pow(4,count);
  num=pow(2,count+1);
  sz=pow(.43,count);
    sine = new SineWave(220*num, 1, out.sampleRate());
    out.addSignal(sine);
  redraw();
 
}
 
 
void draw()
{
 
  colorMode(HSB,100);
  tint(15*count-15, s,b,126);
 
  imageMode(CENTER);
  int x=1;
  int y=1;
 
 
  for(int i=0; i<number; i++) {
 
    if(x>num) {
      x=1;
      y+=2;
    }
    float r=(x*width)/num;
    float s=y*height/num;
    float u=width*sz;
    float v=height*sz;
 
 
 
  image(flower,r,s,u,v);
 
    x+=2;
 
  }
 
}
 
void stop()
{
  // always close Minim audio classes when you are done with them
  out.close();
  // alway stop Minim before exiting
  minim.stop();
 
  super.stop();
}
tracy444a/evil_but_cool_version.txt · Last modified: 2010/09/22 20:35 by tracyam0