Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import processing.core.PApplet;
  2.  
  3. public class Transition extends PApplet
  4. {
  5. private PApplet applet;
  6. private int yOffsetOne;
  7. private int yOffsetTwo;
  8. private boolean transitionComplete = false;
  9. private boolean isFinished = false;
  10.  
  11. public Transition(PApplet applet_){
  12. applet = applet_;
  13. }
  14.  
  15. public void drawTransition(){
  16. applet.fill(0,0,0);
  17. applet.noStroke();
  18. applet.rect(0, -270 + yOffsetOne, 900, 270);
  19. applet.rect(0, 0 + yOffsetTwo, 900, 270);
  20.  
  21. if (!transitionComplete)
  22. transitionStageOne();
  23. else if (transitionComplete)
  24. transitionStageTwo();
  25.  
  26. //changing part, changes transitionComplete boolean
  27. if (yOffsetOne >= 270){
  28. transitionComplete = true;
  29. }
  30. // detect when stage 2 is complete
  31. if (transitionComplete && yOffsetOne <= 0){
  32. isFinished = true;
  33. }
  34. }
  35.  
  36. public void transitionStageOne(){
  37. yOffsetOne++;
  38. yOffsetTwo = 500 - yOffsetOne;
  39. }
  40.  
  41. public void transitionStageTwo(){
  42. yOffsetOne--;
  43. yOffsetTwo = 500 - yOffsetOne;
  44. }
  45.  
  46. public boolean getStatus(){
  47. return transitionComplete;
  48. }
  49.  
  50. public boolean getFinished(){
  51. return isFinished;
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement