Thursday, September 16, 2010
Scribble variation v2
// original scribble by digehode
int width=800;
int height=400;
float x,y;
float lastx,lasty, lastlastx,lastlasty;
void setup(){
size(width,height);
x=0;
y=0;
lastx=0;
lasty=0;
lastlastx=0;
lastlasty=0;
background(255);
smooth();
noStroke();
}
void draw(){
for(int i = 0; i< 10; i++){
fill(random(256),random(256),random(256),80);
lastlastx=lastx;
lastlasty=lasty;
lastx=x;
lasty=y;
float factor = 20*sin(frameCount/10.0);
x=x+random(-factor,factor);
y=y+random(-factor,factor);
if(x>width)
x=width;
if(x<0)
x=0;
if(y>height)
y=height;
if(y<0)
y=0;
//line(x,y,lastx,lasty);
triangle(x,y,lastx,lasty,lastlastx,lastlasty);
}
}
int width=800;
int height=400;
float x,y;
float lastx,lasty, lastlastx,lastlasty;
void setup(){
size(width,height);
x=0;
y=0;
lastx=0;
lasty=0;
lastlastx=0;
lastlasty=0;
background(255);
smooth();
noStroke();
}
void draw(){
for(int i = 0; i< 10; i++){
fill(random(256),random(256),random(256),80);
lastlastx=lastx;
lastlasty=lasty;
lastx=x;
lasty=y;
float factor = 20*sin(frameCount/10.0);
x=x+random(-factor,factor);
y=y+random(-factor,factor);
if(x>width)
x=width;
if(x<0)
x=0;
if(y>height)
y=height;
if(y<0)
y=0;
//line(x,y,lastx,lasty);
triangle(x,y,lastx,lasty,lastlastx,lastlasty);
}
}
comments
loading...
Add a comment:

This sketch has a