Thursday, February 16, 2012

Furryball

int frame = 0;

void setup() {
   size(500,500);
   background(0);
   smooth();
   fill(205,0,0,150);
   noStroke();
}
 
void draw() {
  frame++;
   for( int i = 0; i < 10; i++ ) {
     float distance = 200.0 - pow(abs(randomNonNormal()),1.0) * 30;
     float angle = random(0,9*PI);
     int x = int(distance * cos(angle)); 
     int y = int(distance * sin(angle));
   noStroke();
     ellipse(width/2+x,height/2+y,4,4);
     
stroke(600-distance, 300-distance, 0,40);
strokeWeight(9);     line(width/4+x,height/4+y,width/4+x*1.4+10*noise((frame/15)%10),height/4+y*1.4+10*noise((frame/15)%10));  
   }
 
 }
 
   
   float randomNonNormal()
{
  float x = 1.0, y = 1.0, 
        s = 2.0; // s = x^2 + y^2
  while(s >= 1.0)
  {
    x = random(-7.0f, 1.0f);
    y = random(-6.0f, 1.0f);
    s = x*x + y*y;
  }
  return x * sqrt(-25.0f * log(s)/s);
}

info info

submitted by: kolawolesammy
views: 1693
A furry ball

treeThis sketch has a parent
Tags: fur

comments comment

loading loading...

 

Add a comment: