void mousePressed(){ Point mouse = new Point(mouseX, mouseY); if(this.state == STATE_WARP_FIRST){ if(mouseY > TEXT_Y - 30){ // snap all those important constraints this.firstWarp.markInitialConstraints(); // now set the state this.state = STATE_WARP_BLEND_DOTS; // and all that animation crap for the old stuff this.firstMesh.setFinalDrawPoint(new Point(PIC_X_END, PIC_Y)); this.oldText = newText; this.oldText.setFinalPoint(new Point(TEXT_X_END, TEXT_Y)); // and then the new stuff this.textTimer = 0; this.newText = new SlideText(HINT2, this.slideFont, new Point(TEXT_X_START, TEXT_Y)); this.newText.setFinalPoint(new Point(TEXT_X_MIDDLE, TEXT_Y)); this.firstBlendMesh.setCurrentDrawPoint(new Point(width, PIC_Y)); this.firstBlendMesh.setFinalDrawPoint(new Point(PIC_X - (this.last.width / 2) - 20 , PIC_Y)); this.lastBlendMesh.setCurrentDrawPoint(new Point(width, PIC_Y)); this.lastBlendMesh.setFinalDrawPoint(new Point(PIC_X + (this.last.width / 2) + 20, PIC_Y)); } else { this.firstMesh.snap(mouse, MESH_SELECT_RADIUS); } } else if(this.state == STATE_WARP_LAST){ if(mouseY > TEXT_Y - 30){ // set the important constraints this.lastWarp.markFinalConstraints(); // set the next state this.state = STATE_PRE_ANIMATION; // and get rid of the old stuff this.lastMesh.setFinalDrawPoint(new Point(PIC_X_END, PIC_Y)); this.oldText = newText; this.oldText.setFinalPoint(new Point(TEXT_X_END, TEXT_Y)); // and the new this.newText = new SlideText("composing animation", this.slideFont, new Point(TEXT_X_START, TEXT_Y)); this.newText.setFinalPoint(new Point((width / 2) - textWidth("composing animation"), TEXT_Y)); } else { this.lastMesh.snap(mouse, MESH_SELECT_RADIUS); } } else if(this.state == STATE_WARP_BLEND_DOTS){ if(mouseY > TEXT_Y - 30){ // snap all those important constraints this.faceBlend.useCorrelator(this.correlator); this.firstBlendWarp.showFinalConstraints(); this.firstBlendMesh.repeatCubicSmoothing(FAST_SMOOTH_PASSES); // set the new state this.state = STATE_WARP_BLEND_TWEAK; // and all that animation crap for the old stuff this.firstMesh.setFinalDrawPoint(new Point(PIC_X_END, PIC_Y)); this.oldText = newText; this.oldText.setFinalPoint(new Point(TEXT_X_END, TEXT_Y)); // and then the new stuff this.newText = new SlideText(HINT3, this.slideFont, new Point(TEXT_X_START, TEXT_Y)); this.newText.setFinalPoint(new Point(TEXT_X_MIDDLE, TEXT_Y)); this.faceBlend.setIAlpha(122); this.faceBlend.setFAlpha(122); this.firstBlendMesh.setFinalDrawPoint(new Point(PIC_X , PIC_Y)); this.firstBlendMesh.toggleConstraints(); this.lastBlendMesh.setFinalDrawPoint(new Point(PIC_X, PIC_Y)); } else { this.correlator.mousePressed(); } } else if(this.state == STATE_WARP_BLEND_TWEAK){ if(mouseY > TEXT_Y - 30){ // set the all important constraints this.firstBlendWarp.markFinalConstraints(); this.faceBlend.matchWarps(); // set the new state! this.state = STATE_WARP_LAST; // fix all that old junk this.firstMesh.setFinalDrawPoint(new Point(PIC_X_END, PIC_Y)); this.oldText = newText; this.oldText.setFinalPoint(new Point(TEXT_X_END, TEXT_Y)); this.faceBlend.setIAlpha(255); this.faceBlend.setFAlpha(255); this.firstBlendMesh.setFinalDrawPoint(new Point(PIC_X_END , PIC_Y)); this.firstBlendMesh.toggleConstraints(); this.lastBlendMesh.setFinalDrawPoint(new Point(PIC_X_END, PIC_Y)); // and now for some new stuff! this.newText = new SlideText(HINT4, this.slideFont, new Point(TEXT_X_START, TEXT_Y)); this.newText.setFinalPoint(new Point(TEXT_X_MIDDLE, TEXT_Y)); this.lastMesh.setCurrentDrawPoint(new Point(width, PIC_Y)); this.lastMesh.setFinalDrawPoint(new Point(PIC_X, PIC_Y)); } else { this.firstBlendMesh.snap(mouse, MESH_SELECT_RADIUS); } } else if(this.state == STATE_PRE_ANIMATION){ } else if(this.state == STATE_ANIM_FIRST){ } else if(this.state == STATE_ANIM_BLEND){ } else if(this.state == STATE_ANIM_LAST){ } else if(this.state == STATE_ANIM_DONE){ if(mouseY > TEXT_Y - 30){ if(mouseX > 100 && mouseX < 310){ this.state = STATE_PRE_ANIMATION; } else if(mouseX > 360 && mouseY < 550){ this.state = STATE_LOADING; } } } } void mouseReleased(){ if(this.state == STATE_WARP_FIRST){ this.firstMesh.releaseSnap(); } else if(this.state == STATE_WARP_LAST){ this.lastMesh.releaseSnap(); } else if(this.state == STATE_WARP_BLEND_DOTS){ this.correlator.mouseReleased(); } else if(this.state == STATE_WARP_BLEND_TWEAK){ this.firstBlendMesh.releaseSnap(); } else if(this.state == STATE_PRE_ANIMATION){ } else if(this.state == STATE_ANIM_FIRST){ } else if(this.state == STATE_ANIM_BLEND){ } else if(this.state == STATE_ANIM_LAST){ } else if(this.state == STATE_ANIM_DONE){ } }