Wednesday, July 07, 2010
Furryball v2
// just type here
// and click "submit" when done
int frame = 0;
void setup() {
size(800,400);
background(255);
drawVignettingEffect();
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 = 150.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);
}
void drawVignettingEffect(){
smooth();
background(255);
strokeWeight(180);
noFill();
stroke(180,180,180,5);
translate(width/2,height/2);
for (int i = 0; i < 300; i+=10){
ellipse(0,0,max(width+i,height+i),max(width+i,height+i));
}
resetMatrix();
}
// and click "submit" when done
int frame = 0;
void setup() {
size(800,400);
background(255);
drawVignettingEffect();
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 = 150.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);
}
void drawVignettingEffect(){
smooth();
background(255);
strokeWeight(180);
noFill();
stroke(180,180,180,5);
translate(width/2,height/2);
for (int i = 0; i < 300; i+=10){
ellipse(0,0,max(width+i,height+i),max(width+i,height+i));
}
resetMatrix();
}
comments
loading...
Add a comment: