Refine search
Timeline fiveSecondsWonder = new Timeline(new KeyFrame(Duration.seconds(5), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { System.out.println("this is called every 5 seconds on UI thread"); } })); fiveSecondsWonder.setCycleCount(Timeline.INDEFINITE); fiveSecondsWonder.play();
@Override public <U> void setViewContext(ViewContext<U> context) { updatePlaceholder(context.getRootNode()); if (animation != null) { animation.stop(); } animation = new Timeline(); animation.getKeyFrames().addAll(animationProducer.apply(this)); animation.getKeyFrames().add(new KeyFrame(duration, (e) -> clearPlaceholder())); animation.play(); }
closeAnimation.setCycleCount(1); closeAnimation.setOnFinished(e -> { resetPseudoClass(); processSnackbar(); }); closeAnimation.play();
public void moveCircle(Circle circle, Scene scene) { Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), ev -> { circle.setCenterX(random((int) scene.getX())); circle.setCenterY(random((int) scene.getY())); })); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); }
private void hideError() { if (heightChanged) { new Timeline(new KeyFrame(Duration.millis(160), new KeyValue(translateYProperty(), 0, Interpolator.EASE_BOTH))).play(); // reset the height of text field new Timeline(new KeyFrame(Duration.millis(160), new KeyValue(minHeightProperty(), initHeight, Interpolator.EASE_BOTH))).play(); heightChanged = false; } // clear error label text errorLabel.setText(null); oldErrorLabelHeight = errorLabelInitHeight; // clear error icon errorIcon.getChildren().clear(); // reset the height of the text field currentFieldHeight = initHeight; // hide error container errorContainer.setVisible(false); errorShown = false; }
KeyValue start = new KeyValue(enemy.translateXProperty(), 0); KeyValue end = new KeyValue(enemy.translateXProperty(), 600); KeyFrame startFrame = new KeyFrame(Duration.ZERO, start); KeyFrame endFrame = new KeyFrame(Duration.seconds(5), end); Timeline timeline = new Timeline(startFrame, endFrame); timeline.setAutoReverse(true); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play();
DoubleProperty y = new SimpleDoubleProperty(); Timeline timeline = new Timeline( new KeyFrame(Duration.seconds(0), new KeyValue(x, 0), timeline.setCycleCount(Timeline.INDEFINITE); timeline.play();
public void play() { KeyFrame kf = new KeyFrame(Duration.millis(20), e -> spin()); Timeline tl = new Timeline(kf); tl.setCycleCount(randomize(10,50)); tl.play(); tl.setOnFinished(e -> { int x = this.queue.peek().getKey(); // do whatever you need to do with x here.... }); }
final double[] derivatives = new double[frictions.length]; Timeline timeline = new Timeline(); final EventHandler<MouseEvent> dragHandler = event -> timeline.stop(); final EventHandler<ScrollEvent> scrollHandler = event -> { timeline.play(); timeline.setCycleCount(Animation.INDEFINITE);
private void initializeViewAnimation() { // gets captured in the closure final double defaultMainHorizontalSplitPaneDividerPosition = mainHorizontalSplitPane.getDividerPositions()[0]; // show/ hide bottom pane bottomTabsToggle.selectedProperty().addListener((observable, wasExpanded, isNowExpanded) -> { KeyValue keyValue = null; DoubleProperty divPosition = mainHorizontalSplitPane.getDividers().get(0).positionProperty(); if (wasExpanded && !isNowExpanded) { keyValue = new KeyValue(divPosition, 1); } else if (!wasExpanded && isNowExpanded) { keyValue = new KeyValue(divPosition, defaultMainHorizontalSplitPaneDividerPosition); } if (keyValue != null) { Timeline timeline = new Timeline(new KeyFrame(Duration.millis(200), keyValue)); timeline.play(); } }); }
public void texting(String inc) { IntegerProperty textLength = new IntegerProperty(); Timeline timeline = new Timeline(new KeyFrame(Duration.millis(300)), e -> { textLength.set(textLength.get()+1); labelHeader.setText(inc.substring(0, textLength.get())); }); timeline.setCycleCount(inc.length()); timeline.play(); }
@PostConstruct public void init() { Timeline timeline = new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(blueSpinner.progressProperty(), 0), new KeyValue(greenSpinner.progressProperty(), 0) ), new KeyFrame( Duration.seconds(0.5), new KeyValue(greenSpinner.progressProperty(), 0.5) ), new KeyFrame( Duration.seconds(2), new KeyValue(blueSpinner.progressProperty(), 1), new KeyValue(greenSpinner.progressProperty(), 1) ) ); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play(); }
public void show() { dialog.setOpacity(0); // pickerDecorator.setOpacity(0); if (dialog.getOwner() != null) { dialog.widthProperty().addListener(positionAdjuster); dialog.heightProperty().addListener(positionAdjuster); positionAdjuster.invalidated(null); } if (dialog.getScene() == null) { dialog.setScene(customScene); } curvedColorPicker.preAnimate(); dialog.show(); if (initOnce) { initRun.run(); initOnce = false; } Timeline timeline = new Timeline(new KeyFrame(Duration.millis(120), new KeyValue(dialog.opacityProperty(), 1, Interpolator.EASE_BOTH))); timeline.setOnFinished((finish) -> curvedColorPicker.animate()); timeline.play(); }
/** * init fxml when loaded. */ @PostConstruct public void init() { Timeline task = new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(progress1.progressProperty(), 0), new KeyValue(progress2.progressProperty(), 0), new KeyValue(progress2.secondaryProgressProperty(), 0.5)), new KeyFrame( Duration.seconds(1), new KeyValue(progress2.secondaryProgressProperty(), 1)), new KeyFrame( Duration.seconds(2), new KeyValue(progress1.progressProperty(), 1), new KeyValue(progress2.progressProperty(), 1))); task.setCycleCount(Timeline.INDEFINITE); task.play(); }
newHeight, Interpolator.EASE_BOTH))); errorAnimation.play(); errorAnimation.setOnFinished(finish -> new Timeline(new KeyFrame(Duration.millis(160), new KeyValue(errorContainer.opacityProperty(), 1, Interpolator.EASE_BOTH))).play()); currentFieldHeight = newHeight; oldErrorLabelHeight = newVal.doubleValue(); errorContainer.visibleProperty().addListener((o, oldVal, newVal) -> { new Timeline(new KeyFrame(Duration.millis(160), new KeyValue(errorContainer.opacityProperty(), 1, Interpolator.EASE_BOTH))).play(); }); hideErrorAnimation = new Timeline(new KeyFrame(Duration.millis(160), new KeyValue(errorContainer.opacityProperty(), 0, JFXUtilities.runInFX(() -> showError(newVal)); }); hideErrorAnimation.play(); } else { JFXUtilities.runInFX(this::hideError);
jfxBarInf.setProgress(-1.0f); Timeline timeline = new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(jfxBar.progressProperty(), 1))); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play();
Timeline animation = new Timeline( new KeyFrame(Duration.millis(500), e -> list.getSelectionModel().selectNext())); list.getSelectionModel().select(0); animation.setCycleCount(list.getItems().size()-1); animation.play();