topical media & game development
graphic-processing-algorithm-Ch06-p134-2-p134-2.pde / pde
void setup(){
size(300,300);
frameRate(60);
}
float x=150,y=150,xn=150,yn=150;
void draw(){
//background(255);
if(random(1.)>0.5)
x = x + random(-10,10);
else
y = y + random(-10,10);
x = round(x/10.)*10; //snap
y = round(y/10.)*10;
x = constrain(x,0,width);
y = constrain(y,0,height);
line(x,y,xn,yn);
xn = x;
yn = y;
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.