This repository has been archived by the owner on Dec 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
214 additions
and
102 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package main.view; | ||
|
||
import javafx.animation.FadeTransition; | ||
import javafx.animation.ParallelTransition; | ||
import javafx.animation.TranslateTransition; | ||
import javafx.scene.layout.VBox; | ||
import javafx.util.Duration; | ||
|
||
public class Fade { | ||
|
||
private static Integer transitionDuration = 1000; | ||
|
||
public static ParallelTransition createFadeOutLeft(VBox VBoxToFade) { | ||
// Will become more opaque and translate from the centre towards the left side | ||
FadeTransition newFadeTrans = new FadeTransition(Duration.millis(transitionDuration), VBoxToFade); | ||
newFadeTrans.setFromValue(1.0); | ||
newFadeTrans.setToValue(0.0); | ||
TranslateTransition newTranslateTrans = new TranslateTransition(Duration.millis(transitionDuration), VBoxToFade); | ||
newTranslateTrans.setFromX(0); | ||
newTranslateTrans.setToX(-300); | ||
ParallelTransition returnPT = new ParallelTransition(); | ||
returnPT.getChildren().addAll( | ||
newFadeTrans, | ||
newTranslateTrans | ||
); | ||
return returnPT; | ||
} | ||
|
||
public static ParallelTransition createFadeOutRight(VBox VBoxToFade) { | ||
FadeTransition newFadeTrans = new FadeTransition(Duration.millis(transitionDuration), VBoxToFade); | ||
newFadeTrans.setFromValue(1.0); | ||
newFadeTrans.setToValue(0.0); | ||
TranslateTransition newTranslateTrans = new TranslateTransition(Duration.millis(transitionDuration), VBoxToFade); | ||
newTranslateTrans.setFromX(0); | ||
newTranslateTrans.setToX(300); | ||
ParallelTransition returnPT = new ParallelTransition(); | ||
returnPT.getChildren().addAll( | ||
newFadeTrans, | ||
newTranslateTrans | ||
); | ||
return returnPT; | ||
} | ||
|
||
public static ParallelTransition createFadeInRight(VBox VBoxToFade) { | ||
// Will become less opaque and translate towards the centre from the right side | ||
FadeTransition newFadeTrans = new FadeTransition(Duration.millis(transitionDuration), VBoxToFade); | ||
newFadeTrans.setFromValue(0.0); | ||
newFadeTrans.setToValue(1.0); | ||
TranslateTransition newTranslateTrans = new TranslateTransition(Duration.millis(transitionDuration), VBoxToFade); | ||
newTranslateTrans.setFromX(300); | ||
newTranslateTrans.setToX(0); | ||
ParallelTransition returnPT = new ParallelTransition(); | ||
returnPT.getChildren().addAll( | ||
newFadeTrans, | ||
newTranslateTrans | ||
); | ||
return returnPT; | ||
} | ||
|
||
public static ParallelTransition createFadeInLeft(VBox VBoxToFade) { | ||
FadeTransition newFadeTrans = new FadeTransition(Duration.millis(transitionDuration), VBoxToFade); | ||
newFadeTrans.setFromValue(0.0); | ||
newFadeTrans.setToValue(1.0); | ||
TranslateTransition newTranslateTrans = new TranslateTransition(Duration.millis(transitionDuration), VBoxToFade); | ||
newTranslateTrans.setFromX(-300); | ||
newTranslateTrans.setToX(0); | ||
ParallelTransition returnPT = new ParallelTransition(); | ||
returnPT.getChildren().addAll( | ||
newFadeTrans, | ||
newTranslateTrans | ||
); | ||
return returnPT; | ||
} | ||
|
||
} |
Oops, something went wrong.