Skip to content

Instantly share code, notes, and snippets.

@macklinu
Last active December 11, 2015 11:48
Show Gist options
  • Save macklinu/4596173 to your computer and use it in GitHub Desktop.
Save macklinu/4596173 to your computer and use it in GitHub Desktop.
// Winter Forest
// Include this line if using Processing.js
/* @pjs pauseOnBlur="true"; */
float wiggle = 0;
float angle = -1.0;
void setup() {
size(700, 250);
smooth();
}
void draw() {
background(255);
for (int i = 0; i < width; i++) {
stroke(random(1000)/4, 150);
strokeWeight(random(0.2, 2.5));
line(random(i-wiggle, i+wiggle), 0, random(i-wiggle, i+wiggle), height);
}
wiggle = sin(angle);
wiggle = map(sin(angle), -1.0, 1.0, 0.0, 50.0);
angle += 0.005;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment