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();
timeline.getKeyFrames().clear(); timeline = new Timeline(blueFrame[0], blueFrame[1], blueFrame[2], greenFrame[3], endingFrame); timeline.setCycleCount(Timeline.INDEFINITE); timeline.setDelay(Duration.ZERO); timeline.playFromStart();
closeAnimation.setCycleCount(1); closeAnimation.setOnFinished(e -> { resetPseudoClass(); processSnackbar(); }); closeAnimation.play();
PseudoClass flashHighlight = PseudoClass.getPseudoClass("flash-highlight"); Node flashingNode = ... ; Timeline flasher = new Timeline( new KeyFrame(Duration.seconds(0.5), e -> { flashingNode.pseudoClassStateChanged(flashHighlight, true); }), new KeyFrame(Duration.seconds(1.0), e -> { flashingNode.pseudoClassStateChanged(flashHighlight, false); }) ); flasher.setCycleCount(Animation.INDEFINITE);
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(); }
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();
private FxTimer(java.time.Duration timeout, Runnable action, int cycles) { this.timeout = Duration.millis(timeout.toMillis()); this.timeline = new Timeline(); this.action = action; timeline.setCycleCount(cycles); }
timerLabel.setVisible(false); final Timeline timeline = new Timeline(); timeline.setCycleCount(TOTALTIME); KeyFrame keyFrame = new KeyFrame(Duration.seconds(1), e->count.set(count.get()-1)); timeline.getKeyFrames().add(keyFrame);
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.... }); }
public SeamapImageView(Image mapImage, double width, double height, Point2D focus, double scale) { super(); imgView = new ImageView(); shipCanvas = new Pane(); shipCanvas.setId("shipCanvas"); clip = new Rectangle(0, 0, width, height); Color slideColor = new Color(1, 1, 1, 0.1); slaveClip = new Rectangle(0, 0, width, height); scrollLeft = new Rectangle(0, 0, 50, height); scrollLeft.setFill(slideColor); scrollRight = new Rectangle(width - 50, 0, 50, height); scrollRight.setFill(slideColor); slideLeftAnimation = new Timeline(); slideLeftAnimation.setCycleCount(Animation.INDEFINITE); KeyFrame kf1 = new KeyFrame(Duration.millis(50), event -> resetClipXPosition(clip.getX() - 5)); slideLeftAnimation.getKeyFrames().add(kf1); slideRightAnimation = new Timeline(); slideRightAnimation.setCycleCount(Animation.INDEFINITE); KeyFrame kf2 = new KeyFrame(Duration.millis(50), event -> resetClipXPosition(clip.getX() + 5)); slideRightAnimation.getKeyFrames().add(kf2); this.mapImage = mapImage; this.focus = focus; this.scale.set(scale); } @PostConstruct
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);
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(); }
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(2500)), new KeyFrame(Duration.millis(0), new KeyValue(node.scaleXProperty(), 1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1, EASE_BOTH), new KeyValue(node.rotateProperty(), 0, EASE_BOTH))); timeline.setCycleCount(Timeline.INDEFINITE); timeline.setDelay(Duration.millis(2000)); return timeline;
@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(); }
new KeyFrame(duration, new KeyValue(circle.centerYProperty(), circle.getCenterY()+dy))); animation.setAutoReverse(true); animation.setCycleCount(Animation.INDEFINITE); animation.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(); }
closeAnimation.setCycleCount(1); closeAnimation.setOnFinished(e -> { resetPseudoClass(); processSnackbar(); }); closeAnimation.play();
jfxBarInf.setProgress(-1.0f); Timeline timeline = new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(jfxBar.progressProperty(), 1))); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play();
Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { snake.updatePosition(); } } )); timeline.setCycleCount(Animation.INDEFINITE); timeline.play();