Saturday, September 12, 2009

Furryball

// just type here
// and click "submit" when done

int frame = 0;

void setup() {
   size(600,600);
   background(255);
   smooth();
   fill(255,0,0,10);
   noStroke();
}
 
void draw() {
  frame++;
   //background(255,255,255,10);
   // Draw points
   for( int i = 0; i < 100; i++ ) {
     float distance = 200.0 - pow(abs(randomNonNormal()),1.0) * 30;
     float angle = random(0,2*PI);
     int x = int(distance * cos(angle)); 
     int y = int(distance * sin(angle));
   noStroke();
     ellipse(width/2+x,height/2+y,4,4);
     
stroke(204-distance, 102-distance, 0,40);
strokeWeight(1);     line(width/2+x,height/2+y,width/2+x*1.2+10*noise((frame/5)%10),height/2+y*1.2+10*noise((frame/5)%10));  
   }
 
 }
 
   
   float randomNonNormal()
{
  float x = 1.0, y = 1.0, 
        s = 2.0; // s = x^2 + y^2
  while(s >= 1.0)
  {
    x = random(-1.0f, 1.0f);
    y = random(-1.0f, 1.0f);
    s = x*x + y*y;
  }
  return x * sqrt(-15.0f * log(s)/s);
}

info info

submitted by: DARYL_Gamma
views: 2795
A furry ball

treeThis sketch has a parent
Tags: fur

comments comment

loading loading...

 

Add a comment: