Tool to display Walter Giers' notebooks in either chronological or in random order
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

notizheftanzeiger.pde 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import java.util.*;
  2. //////// Config
  3. int autoplayMode = RANDOM; //NORMAL or RANDOM order
  4. int interactMode = NORMAL;
  5. float timerTime = 5000; //in milliseconds how long slide is shown
  6. float transitionTime = 1000; //how long it takes to fade the next slide in. must not be greater than "timerTime"
  7. float continueAutoplayTime = 60000; //how long until the app goes back to autoplay after a user interacted with it
  8. boolean displayText = true; //if the "date" should be written on screen
  9. boolean displayTimeline = true; //if the timeline should be drawn on screen
  10. boolean interactiveTimeline = true; //if the user can select a year via timeline
  11. //
  12. Timer timer;
  13. Timeline timeline;
  14. ArrayList<Notebook> notebooks = new ArrayList<Notebook>();
  15. PImage currentSlide, nextSlide;
  16. int currentNotebookNo, currentSlideNo;
  17. int startTransitionTime, startInteractionTime;
  18. boolean transition, interactive;
  19. float transitionProgress;
  20. final static int NORMAL = 0;
  21. final static int RANDOM = 1;
  22. String[] save;
  23. void setup() {
  24. //fullScreen(); //if using fullScreen, comment the next line
  25. size(960, 540);
  26. fill(255);
  27. save = loadStrings(dataPath("") + "/save.sav");
  28. currentNotebookNo = int(save[0]);
  29. currentSlideNo = int(save[1]);
  30. if (displayTimeline) {
  31. textSize(20);
  32. textAlign(CENTER);
  33. } else {
  34. textSize(20);
  35. }
  36. timer = new Timer(timerTime);
  37. timeline = new Timeline(50, height-30, width-100);
  38. createNotebooks();
  39. currentSlide = Slide(currentNotebookNo, currentSlideNo);
  40. }
  41. void draw() {
  42. if (!interactive) {
  43. timer.update();
  44. } else {
  45. if (millis() > startInteractionTime + continueAutoplayTime) {
  46. interactive = false;
  47. }
  48. }
  49. tint(255, 255);
  50. image(currentSlide, 0, 0, width, height);
  51. if (transition) {
  52. transitionProgress = map(millis(), startTransitionTime, startTransitionTime + transitionTime, 0, 255);
  53. tint(255, transitionProgress);
  54. image(nextSlide, 0, 0, width, height);
  55. if (millis() - startTransitionTime > transitionTime) {
  56. save[0] = str(currentNotebookNo);
  57. save[1] = str(currentSlideNo);
  58. saveStrings(dataPath("") + "/save.sav", save);
  59. currentSlide = nextSlide;
  60. transitionProgress = 0;
  61. transition = false;
  62. }
  63. }
  64. if (displayTimeline) {
  65. timeline.update();
  66. timeline.display();
  67. } else {
  68. if (displayText) text(notebooks.get(currentNotebookNo).dateText, 20, 40);
  69. }
  70. }