Search in sources :

Example 31 with Timeline

use of javafx.animation.Timeline in project fxexperience2 by EricCanull.

the class FadeOutDownBigTransition method starting.

@Override
protected void starting() {
    double endY = node.getScene().getHeight() - node.localToScene(0, 0).getY();
    timeline = new Timeline(new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 0, WEB_EASE)), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), endY, WEB_EASE)));
    super.starting();
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Example 32 with Timeline

use of javafx.animation.Timeline in project fxexperience2 by EricCanull.

the class BounceInDownTransition method starting.

@Override
protected void starting() {
    double startY = -node.localToScene(0, 0).getY() - node.getBoundsInParent().getHeight();
    timeline = new Timeline();
    timeline.getKeyFrames().add(new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), startY, WEB_EASE)));
    timeline.getKeyFrames().add(new KeyFrame(Duration.millis(600), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 30, WEB_EASE)));
    timeline.getKeyFrames().add(new KeyFrame(Duration.millis(800), new KeyValue(node.translateYProperty(), -10, WEB_EASE)));
    timeline.getKeyFrames().add(new KeyFrame(Duration.millis(1000), new KeyValue(node.translateYProperty(), 0, WEB_EASE)));
    super.starting();
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Example 33 with Timeline

use of javafx.animation.Timeline in project fxexperience2 by EricCanull.

the class BounceOutDownTransition method starting.

@Override
protected void starting() {
    double endY = node.getScene().getHeight() - node.localToScene(0, 0).getY();
    timeline = new Timeline(new KeyFrame(Duration.millis(0), new KeyValue(node.translateYProperty(), 0, WEB_EASE)), new KeyFrame(Duration.millis(200), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), -20, WEB_EASE)), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), endY, WEB_EASE)));
    super.starting();
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Example 34 with Timeline

use of javafx.animation.Timeline in project fxexperience2 by EricCanull.

the class FadeInLeftBigTransition method starting.

@Override
protected void starting() {
    double startX = -node.localToScene(0, 0).getX() - node.getBoundsInParent().getWidth();
    timeline = new Timeline(new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateXProperty(), startX, WEB_EASE)), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateXProperty(), 0, WEB_EASE)));
    super.starting();
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Example 35 with Timeline

use of javafx.animation.Timeline in project jgnash by ccavanaugh.

the class ConsoleDialogController method initialize.

@FXML
void initialize() {
    oldErrStream = System.err;
    oldOutStream = System.out;
    // Force a monospaced font
    consoleArea.setFont(Font.font("Monospaced", consoleArea.getFont().getSize()));
    Engine.getLogger().addHandler(logHandler);
    try {
        outStream = new PrintStream(new OutputStream() {

            @Override
            public void write(int b) {
                oldOutStream.write(b);
                JavaFXUtils.runLater(() -> consoleArea.appendText(String.valueOf((char) b)));
            }
        }, false, Charset.defaultCharset().name());
    } catch (final UnsupportedEncodingException ex) {
        Logger.getLogger(ConsoleDialogController.class.getName()).log(Level.SEVERE, null, ex);
    }
    try {
        errStream = new PrintStream(new OutputStream() {

            @Override
            public void write(int b) {
                oldErrStream.write(b);
                JavaFXUtils.runLater(() -> consoleArea.appendText(String.valueOf((char) b)));
            }
        }, false, Charset.defaultCharset().name());
    } catch (final UnsupportedEncodingException ex) {
        Logger.getLogger(ConsoleDialogController.class.getName()).log(Level.SEVERE, null, ex);
    }
    // Plug in the new streams
    System.setOut(outStream);
    System.setErr(errStream);
    timeline = new Timeline(new KeyFrame(Duration.millis(REFRESH_PERIOD), new EventHandler<ActionEvent>() {

        private long total;

        private long used;

        private long oldUsed;

        private static final int diff = 1;

        @Override
        public void handle(ActionEvent event) {
            total = runtime.totalMemory() / BYTES_PER_MB;
            used = total - runtime.freeMemory() / BYTES_PER_MB;
            if (used < oldUsed - diff || used > oldUsed + diff) {
                JavaFXUtils.runLater(() -> {
                    memoryUsageProgressBar.setProgress((double) used / (double) total);
                    memoryUsageText.setText(used + "/" + total + " MB");
                });
                oldUsed = used;
            }
        }
    }));
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
    // Close with the main application
    MainView.getPrimaryStage().addEventHandler(WindowEvent.WINDOW_CLOSE_REQUEST, event -> handleCloseAction());
}
Also used : PrintStream(java.io.PrintStream) Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) OutputStream(java.io.OutputStream) UnsupportedEncodingException(java.io.UnsupportedEncodingException) KeyFrame(javafx.animation.KeyFrame) InjectFXML(jgnash.uifx.util.InjectFXML) FXML(javafx.fxml.FXML)

Aggregations

Timeline (javafx.animation.Timeline)111 KeyFrame (javafx.animation.KeyFrame)107 KeyValue (javafx.animation.KeyValue)81 Duration (javafx.util.Duration)32 ActionEvent (javafx.event.ActionEvent)22 JFXButton (com.jfoenix.controls.JFXButton)20 IOException (java.io.IOException)19 URL (java.net.URL)19 ResourceBundle (java.util.ResourceBundle)19 FXML (javafx.fxml.FXML)19 Initializable (javafx.fxml.Initializable)18 FXMLLoader (javafx.fxml.FXMLLoader)17 Pane (javafx.scene.layout.Pane)17 AnchorPane (javafx.scene.layout.AnchorPane)16 Level (java.util.logging.Level)15 Logger (java.util.logging.Logger)15 MouseEvent (javafx.scene.input.MouseEvent)14 Rotate (javafx.scene.transform.Rotate)14 JFXTextField (com.jfoenix.controls.JFXTextField)12 Interpolator (javafx.animation.Interpolator)12