Commit | Line | Data |
---|---|---|
c879c4db AM |
1 | package org.lttng.scope.tmf2.views.ui.jfx.examples; |
2 | ||
3 | import org.eclipse.jdt.annotation.Nullable; | |
4 | ||
5 | import javafx.animation.FadeTransition; | |
6 | import javafx.application.Application; | |
7 | import javafx.scene.Group; | |
8 | import javafx.scene.Scene; | |
9 | import javafx.scene.shape.Rectangle; | |
10 | import javafx.stage.Stage; | |
11 | import javafx.util.Duration; | |
12 | ||
13 | public class FadeTransitionEx extends Application { | |
14 | ||
15 | public static void main(String[] args) { | |
16 | Application.launch(args); | |
17 | } | |
18 | ||
19 | @Override | |
20 | public void start(@Nullable Stage primaryStage) { | |
21 | if (primaryStage == null) { | |
22 | return; | |
23 | } | |
24 | ||
25 | Group group = new Group(); | |
26 | Rectangle rect = new Rectangle(20,20,200,200); | |
27 | ||
28 | FadeTransition ft = new FadeTransition(Duration.millis(5000), rect); | |
29 | ft.setFromValue(1.0); | |
30 | ft.setToValue(0.0); | |
31 | ft.play(); | |
32 | ||
33 | group.getChildren().add(rect); | |
34 | ||
35 | Scene scene = new Scene(group, 300, 200); | |
36 | primaryStage.setScene(scene); | |
37 | primaryStage.show(); | |
38 | } | |
39 | } |