Advertisement
xeromino

glitch

May 12th, 2014
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. // based upon P_4_1_2_01.pde
  2. //
  3. // Generative Gestaltung, ISBN: 978-3-87439-759-9
  4. // First Edition, Hermann Schmidt, Mainz, 2009
  5. // Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
  6. // Copyright 2009 Hartmut Bohnacker, Benedikt Gross, Julia Laub, Claudius Lazzeroni
  7. //
  8. // http://www.generative-gestaltung.de
  9. //
  10.  
  11. PImage img;
  12.  
  13. void setup() {
  14.   background(0);
  15.   img = loadImage("http://media-cache-ak0.pinimg.com/736x/2c/f6/a5/2cf6a58f75b368949cf98db03b925f1b.jpg");
  16.   size(img.width+200, img.height);
  17.   image(img, 100, 0);
  18.   frameRate(5);
  19. }
  20.  
  21. void draw() {
  22.   int x1 = 0;
  23.   int y1 = (int) random(0, height);
  24.  
  25.   int y2 = round(y1 + random(-7, 7));
  26.   int x2 = round(random(-5, 5));
  27.  
  28.   int w = width;
  29.   int h = (int) random(35, 50);
  30.  
  31.   copy(x1, y1, w, h, x2, y2, w, h);
  32. }
  33.  
  34. void keyReleased() {
  35.   if (keyCode == DELETE || keyCode == BACKSPACE) {
  36.     background(0);
  37.     image(img, 0, 100);
  38.   }
  39.   if (key=='s' || key=='S') saveFrame("image_##.png");
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement