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();
}
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();
}
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();
}
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();
}
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());
}
Aggregations