Tool to display Walter Giers' notebooks in either chronological or in random order
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Slide.pde 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. PImage Slide(int notebookID, int pageNumber) {
  2. PImage leftPage, rightPage;
  3. PGraphics result;
  4. String path = notebooks.get(notebookID).notebookpath + "/";
  5. leftPage = loadImage(path + notebooks.get(notebookID).imagepaths[pageNumber]);
  6. rightPage = loadImage(path + notebooks.get(notebookID).imagepaths[pageNumber+1]);
  7. result = createGraphics(width, height);
  8. result.beginDraw();
  9. result.image(leftPage, 0, 0, result.width/2, result.height);
  10. result.image(rightPage, result.width/2, 0, result.width/2, result.height);
  11. result.endDraw();
  12. return result.get();
  13. }
  14. void nextSlide(int mode) {
  15. transition = true;
  16. startTransitionTime = millis();
  17. if (mode == NORMAL) {
  18. currentSlideNo+=2;
  19. if (currentSlideNo > notebooks.get(currentNotebookNo).imagepaths.length-1) {
  20. currentSlideNo = 0;
  21. currentNotebookNo++;
  22. if(currentNotebookNo == notebooks.size()) currentNotebookNo = 0;
  23. }
  24. } else if (mode == RANDOM) {
  25. currentNotebookNo = (int)random(notebooks.size());
  26. currentSlideNo = (int)random(notebooks.get(currentNotebookNo).imagepaths.length-1);
  27. if (currentSlideNo %2 != 0) {
  28. currentSlideNo -= 1;
  29. }
  30. }
  31. currentYear = notebooks.get(currentNotebookNo).year;
  32. nextSlide = Slide(currentNotebookNo, currentSlideNo);
  33. }
  34. void nextSlide(int bookNo, int pageNo){
  35. transition = true;
  36. startTransitionTime = millis();
  37. currentNotebookNo = bookNo;
  38. currentSlideNo = pageNo;
  39. currentYear = notebooks.get(bookNo).year;
  40. nextSlide = Slide(bookNo, pageNo);
  41. }