Advertisement
hamoid

landscape of noise lines

Jan 5th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. // vertical start
  2. float y = 80;
  3. // vertical displacement between lines
  4. float dy = 1;
  5. void setup () {
  6.   size (800, 600);
  7.   background(100);
  8. }
  9.  
  10. void draw () {
  11.   // stop drawing before we get out of the screen
  12.   if (y < 500) {
  13.     float lastx = -20;
  14.     float lasty = 0;
  15.     float currx = 0;
  16.     float curry = 0;
  17.     while (currx < width) {
  18.       currx = lastx + 10;
  19.       curry = y + 80 * noise(currx/70, y/70);
  20.       line (lastx, lasty, currx, curry);
  21.       lastx = currx;
  22.       lasty = curry;
  23.     }
  24.     // move down
  25.     y = y + dy;
  26.     // increase line separation
  27.     dy = dy * 1.1;
  28.   }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement