Week 4: Dynamic generative patterns
Drawing Machine: inspired by thee brownian motion example on processing
// LittleBrother
int num = 10000;
float mx[] = new float[num];
float my[] = new float[num];
int countMe=0;
int countBrother=20;
void setup()
{
size(800, 400);
smooth();
background(0);
fill(255);
framerate(60);
stroke(255);
line(width/2,0,width/2,height);
noStroke();
}
void draw()
{
countMe++;
mx[countMe] = mouseX;
my[countMe] = mouseY;
if(mouseX==pmouseX && mouseY==pmouseY && mousePressed == false) { //littleBrother
if(countBrother < countMe) {
countBrother++;
stroke(255);
strokeWeight(random(0.5,4));
line(400+mx[countBrother]+random(-2.0,2.0), my[countBrother]+random(-2,2),mx[countBrother-1]+400,my[countBrother-1]);
}
}
else if(mousePressed) { //bigBrother
stroke(0,100,155,255);
strokeWeight(3);
line(mouseX,mouseY,pmouseX,pmouseY);
}
}
void mouseReleased() {
float diameter = random (1,10);
noStroke();
ellipse (random(width/2,width), random(height), diameter, diameter);
}
Drawing Machine: inspired by thee brownian motion example on processing
// LittleBrother
int num = 10000;
float mx[] = new float[num];
float my[] = new float[num];
int countMe=0;
int countBrother=20;
void setup()
{
size(800, 400);
smooth();
background(0);
fill(255);
framerate(60);
stroke(255);
line(width/2,0,width/2,height);
noStroke();
}
void draw()
{
countMe++;
mx[countMe] = mouseX;
my[countMe] = mouseY;
if(mouseX==pmouseX && mouseY==pmouseY && mousePressed == false) { //littleBrother
if(countBrother < countMe) {
countBrother++;
stroke(255);
strokeWeight(random(0.5,4));
line(400+mx[countBrother]+random(-2.0,2.0), my[countBrother]+random(-2,2),mx[countBrother-1]+400,my[countBrother-1]);
}
}
else if(mousePressed) { //bigBrother
stroke(0,100,155,255);
strokeWeight(3);
line(mouseX,mouseY,pmouseX,pmouseY);
}
}
void mouseReleased() {
float diameter = random (1,10);
noStroke();
ellipse (random(width/2,width), random(height), diameter, diameter);
}
0 Comments:
Post a Comment
<< Home