Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.core.PApplet;
- public class Transition extends PApplet
- {
- private PApplet applet;
- private int yOffsetOne;
- private int yOffsetTwo;
- private boolean transitionComplete = false;
- private boolean isFinished = false;
- public Transition(PApplet applet_){
- applet = applet_;
- }
- public void drawTransition(){
- applet.fill(0,0,0);
- applet.noStroke();
- applet.rect(0, -270 + yOffsetOne, 900, 270);
- applet.rect(0, 0 + yOffsetTwo, 900, 270);
- if (!transitionComplete)
- transitionStageOne();
- else if (transitionComplete)
- transitionStageTwo();
- //changing part, changes transitionComplete boolean
- if (yOffsetOne >= 270){
- transitionComplete = true;
- }
- // detect when stage 2 is complete
- if (transitionComplete && yOffsetOne <= 0){
- isFinished = true;
- }
- }
- public void transitionStageOne(){
- yOffsetOne++;
- yOffsetTwo = 500 - yOffsetOne;
- }
- public void transitionStageTwo(){
- yOffsetOne--;
- yOffsetTwo = 500 - yOffsetOne;
- }
- public boolean getStatus(){
- return transitionComplete;
- }
- public boolean getFinished(){
- return isFinished;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement