-
Notifications
You must be signed in to change notification settings - Fork 0
/
SplashController.java
89 lines (77 loc) · 2.77 KB
/
SplashController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package controller;
import Main.Signin;
import javafx.animation.FadeTransition;
import javafx.animation.PathTransition;
import javafx.animation.Timeline;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.layout.AnchorPane;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
import javafx.stage.Stage;
import javafx.util.Duration;
import java.net.URL;
import java.util.ResourceBundle;
public class SplashController implements Initializable
{
@FXML
private AnchorPane anchorPane;
@FXML
private Circle rect,rect1,rect2,rect3,rect4;
Signin su;
Stage stage;
public void Main( Signin su,Stage stage)
{
this.stage = stage;
this.su = su;
}
@Override
public void initialize(URL location, ResourceBundle resources)
{
new Splash().start();
PathTransition pt = new PathTransition(Duration.millis(3000),new Line(0,20,1000,20),rect);
pt.setCycleCount(Timeline.INDEFINITE);
pt.play();
PathTransition pt1 = new PathTransition(Duration.millis(3020),new Line(0,20,1000,20),rect1);
pt1.setCycleCount(Timeline.INDEFINITE);
pt1.play();
PathTransition pt2 = new PathTransition(Duration.millis(3040),new Line(0,20,1000,20),rect2);
pt2.setCycleCount(Timeline.INDEFINITE);
pt2.play();
PathTransition pt3 = new PathTransition(Duration.millis(3060),new Line(0,20,1000,20),rect3);
pt3.setCycleCount(Timeline.INDEFINITE);
pt3.play();
PathTransition pt4 = new PathTransition(Duration.millis(3080),new Line(0,20,1000,20),rect4);
pt4.setCycleCount(Timeline.INDEFINITE);
pt4.play();
}
class Splash extends Thread
{
@Override
public void run()
{
Platform.runLater(new Runnable() {
@Override
public void run() {
try
{
Thread.sleep(1500);
FadeTransition fadeTransition = new FadeTransition(Duration.seconds(20), anchorPane);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.setCycleCount(1);
fadeTransition.play();
fadeTransition.setOnFinished(e ->
{
su.splashWindowClose();
su.introductionWindow();
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
}
}
}