Guest User

Untitled

a guest
Oct 21st, 2019
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int w = 20;
  2. int h = 20;
  3. int index = 10;
  4.  
  5. void setup(){
  6. size(500,300);
  7. background(0);
  8. strokeWeight(5);
  9. stroke(255);
  10. smooth();
  11. }
  12.  
  13. void draw() {
  14. int x1 = w* index;
  15. int x2 = x1+w;
  16. int y1= h*10;
  17. int y2 = h*11;
  18. if (random(2) < 1) {
  19. line (x2,y1,x1,y2);
  20. }else{
  21. line(x1,y1,x2,y2);
  22. }
  23. index++;
  24. if (index== width/w) {
  25. //PImage(width, height, format, factor)
  26. PImage p = get( 0, h, width, h*10);
  27. background (0);
  28. set(0,0,p);
  29. index=0;
  30.  
  31. }
  32.  
  33. }
RAW Paste Data