123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import java.util.*;
-
- //////// Config
-
- int mode = RANDOM; //NORMAL or RANDOM order
- float timerTime = 250; //in milliseconds how long slide is shown
- float transitionTime = 100; //how long it takes to fade the next slide in. must not be greater than "timerTime"
- boolean displayText = true; //if the "date" should be written on screen
- boolean displayTimeline = true; //if the timeline should be drawn on screen
-
- //
-
- Timer timer;
- ArrayList<Notebook> notebooks = new ArrayList<Notebook>();
- PImage currentSlide, nextSlide;
- int currentNotebookNo, currentSlideNo;
- int startTransitionTime;
- boolean transition;
- float transitionProgress;
- final static int NORMAL = 0;
- final static int RANDOM = 1;
- String[] save;
-
- void setup() {
- //fullScreen(); //if using fullScreen, comment the next line
- size(960, 540);
- fill(255);
- save = loadStrings(dataPath("") + "/save.sav");
- currentNotebookNo = int(save[0]);
- currentSlideNo = int(save[1]);
-
- if (displayTimeline) {
- textSize(20);
- textAlign(CENTER);
- } else {
- textSize(20);
- }
- timer = new Timer(timerTime);
- createNotebooks();
- currentSlide = Slide(currentNotebookNo, currentSlideNo);
- //if (mode == RANDOM) nextSlide();
- }
-
- void draw() {
- timer.update();
- tint(255, 255);
- image(currentSlide, 0, 0, width, height);
-
- if (transition) {
- transitionProgress = map(millis(), startTransitionTime, startTransitionTime + transitionTime, 0, 255);
- tint(255, transitionProgress);
- image(nextSlide, 0, 0, width, height);
- if (millis() - startTransitionTime > transitionTime) {
-
- save[0] = str(currentNotebookNo);
- save[1] = str(currentSlideNo);
- saveStrings(dataPath("") + "/save.sav", save);
-
- currentSlide = nextSlide;
- transitionProgress = 0;
- transition = false;
- }
- }
-
- if (displayTimeline) {
- stroke(255, 127);
- strokeWeight(4);
- line(50, height-30, width-50, height-30);
- int xPos = (int)map(notebooks.get(currentNotebookNo).year, 1966, 2012, 50, width-50);
- ellipse(xPos, height-30, 20, 20);
- if (displayText) text(notebooks.get(currentNotebookNo).year, xPos, height-50);
- } else {
- if (displayText) text(notebooks.get(currentNotebookNo).dateText, 20, 40);
- }
- }
|