Guest User

Untitled

a guest
Nov 17th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. /*
  2. Stochastic Image Rotater
  3. Created: November, 15, 2017
  4. Author: Verity Griscti
  5. Version: 1.0
  6.  
  7. This script randomly iterates through #-number of sequentially labeled images.
  8. (default format "image<number>.png")
  9.  
  10. Images must be saved in the same file as the pde.
  11.  
  12. The output is saved as a .gif Animation so it can be shared easily over the web.
  13. (press mouse button to end gif loop)
  14.  
  15. The gifAnimation library is required for this to work.
  16. */
  17.  
  18. import gifAnimation.*;
  19. GifMaker gifExport;
  20.  
  21. void setup(){
  22. size(400,400);
  23. frameRate(20);
  24. gifExport = new GifMaker(this, "export.gif");
  25. gifExport.setRepeat(0); //= loop forever
  26. }
  27.  
  28. void draw(){
  29.  
  30. String imgName = "image" + int(random(1,4)) + ".png"; // reset to follow image title format
  31.  
  32. PImage img;
  33. img = loadImage(imgName);
  34. image(img,0,0,width,height);
  35.  
  36. gifExport.setDelay(5);
  37. gifExport.addFrame();
  38.  
  39. }
  40.  
  41.  
  42. void mousePressed(){
  43. gifExport.finish();
  44. }
Add Comment
Please, Sign In to add comment