-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWelcomePage.java
129 lines (91 loc) · 3.5 KB
/
WelcomePage.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author hayam
*/
package project;
import javafx.animation.FadeTransition;
import javafx.animation.Interpolator;
import javafx.animation.PathTransition;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.scene.shape.VLineTo;
import javafx.util.Duration;
/**
*
* @author layan
*/
public class WelcomePage {
public static Scene scene;
public static WelcomePage createWelcomePage() {
StackPane stack = new StackPane();
Pane pane = new Pane();
CommonElements.mp.play();
ImageView bg = new ImageView("project/WelcomePageBG.png");
bg.setFitHeight(CommonElements.screenHeight);
bg.setFitWidth(CommonElements.screenWidth);
ImageView title = new ImageView("project/newTitle.png");
ImageView catchphrase = new ImageView("project/newcatchpraseWelcome.png");
ImageView startphrase = new ImageView("project/newStart.png");
title.setX(300);
title.setY(400);
title.setFitHeight(380);
title.setFitWidth(1500);
Path path = new Path();
path.getElements().addAll(new MoveTo(CommonElements.screenWidth/2,CommonElements.screenHeight),new VLineTo(175));
pane.getChildren().addAll(title);
PathTransition pt = new PathTransition(Duration.millis(10000),path,title);
pt.setCycleCount(1);
pt.setAutoReverse(false);
pt.play();
FadeTransition fade = new FadeTransition();
FadeTransition fade2 = new FadeTransition();
pt.setOnFinished(e->{
fade.setNode(catchphrase);
fade.setDuration(Duration.millis(500));
fade.setCycleCount(1);
fade.setInterpolator(Interpolator.LINEAR);
fade.setFromValue(0);
fade.setToValue(1);
catchphrase.setX(300);
catchphrase.setY(630);
startphrase.setX(700);
startphrase.setY(700);
startphrase.setFitHeight(100);
startphrase.setFitWidth(550);
fade2.setNode(startphrase);
fade2.setDuration(Duration.millis(500));
fade2.setCycleCount(1);
fade2.setInterpolator(Interpolator.LINEAR);
fade2.setFromValue(0);
fade2.setToValue(1);
catchphrase.setX(300);
catchphrase.setY(630);
fade.play();
fade2.play();
pane.getChildren().addAll(catchphrase,startphrase);
});
stack.getChildren().addAll(bg,pane);
scene = new Scene(stack,CommonElements.screenWidth,CommonElements.screenHeight);
stack.setOnMouseClicked((MouseEvent e)->{
Launch.switchToRegPage();
});
WelcomePage w = new WelcomePage();
w.scene = scene;
return w;
}
}