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.2KB

12345678910111213141516171819202122232425262728293031323334353637
  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() {
  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. nextSlide = Slide(currentNotebookNo, currentSlideNo);
  32. //currentSlide = Slide(currentNotebookNo, currentSlideNo);
  33. }