Skip to content

Instantly share code, notes, and snippets.

Created February 23, 2012 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1894726 to your computer and use it in GitHub Desktop.
Save anonymous/1894726 to your computer and use it in GitHub Desktop.
Processing sketch used to generate the grass in the footer of knolleary.net
// http://knolleary.net/2011/04/06/processing-the-theme/
void setup() {
size(2000,50);
background(240);
smooth();
strokeJoin(ROUND);
stroke(255);
fill(255);
rect(0,0,2000,40);
stroke(153);
fill(240);
beginShape();
vertex(0,42);
int x = 0;
for (int i=0;i<200;i++) {
int y = (int)random(15,30);
bezierVertex(x,37,
x,30,
x+random(-4,4),y);
bezierVertex(x+2,30,
x+2,37,
x+random(8,9),40);
x+=10;
int w = (int)random(5,15);
bezierVertex(x+(w/3),42,
x+(2*w/3),42,
x+w,40);
x += w;
}
vertex(2000,42);
endShape();
save("footerGrass.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment