Sunday, January 24, 2010
Hairy thingaby
// just type here
// and click "submit" when done
int frame = 0;
void setup() {
size(800,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);
float x = int(distance * cos((angle+distance)));
float y = int(distance * log(sin(distance)*1000));
y += sin(x/angle)*50;
stroke(50, distance/2, 0,40);
strokeWeight(1);
if (abs(y) < 60)
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) + sin(x/10)*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);
}
// and click "submit" when done
int frame = 0;
void setup() {
size(800,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);
float x = int(distance * cos((angle+distance)));
float y = int(distance * log(sin(distance)*1000));
y += sin(x/angle)*50;
stroke(50, distance/2, 0,40);
strokeWeight(1);
if (abs(y) < 60)
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) + sin(x/10)*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);
}
comments

Add a comment: