javafx.animation.Timeline Java Examples

The following examples show how to use javafx.animation.Timeline. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StrokeTransitionSample.java    From marathonv5 with Apache License 2.0 8 votes vote down vote up
public StrokeTransitionSample() {
    super(150,150);
    Rectangle rect = new Rectangle(0, 0, 150, 150);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(null);
    rect.setStroke(Color.DODGERBLUE);
    rect.setStrokeWidth(10);
    getChildren().add(rect);
    
    strokeTransition = StrokeTransitionBuilder.create()
        .duration(Duration.seconds(3))
        .shape(rect)
        .fromValue(Color.RED)
        .toValue(Color.DODGERBLUE)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
 
Example #2
Source File: KeyStrokeMotion.java    From marathonv5 with Apache License 2.0 7 votes vote down vote up
private void createLetter(String c) {
    final Text letter = new Text(c);
    letter.setFill(Color.BLACK);
    letter.setFont(FONT_DEFAULT);
    letter.setTextOrigin(VPos.TOP);
    letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
    letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
    getChildren().add(letter);
    // over 3 seconds move letter to random position and fade it out
    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(
            new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent event) {
                    // we are done remove us from scene
                    getChildren().remove(letter);
                }
            },
            new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
            new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
            new KeyValue(letter.opacityProperty(), 0f)
    ));
    timeline.play();
}
 
Example #3
Source File: DataAppPreloader.java    From marathonv5 with Apache License 2.0 7 votes vote down vote up
@Override public void start(Stage stage) throws Exception {
    preloaderStage = stage;
    preloaderStage.setScene(preloaderScene);
    preloaderStage.show();
    
    if (DEMO_MODE) {
        final DoubleProperty prog = new SimpleDoubleProperty(0){
            @Override protected void invalidated() {
                handleProgressNotification(new ProgressNotification(get()));
            }
        };
        Timeline t = new Timeline();
        t.getKeyFrames().add(new KeyFrame(Duration.seconds(20), new KeyValue(prog, 1)));
        t.play();
    }
}
 
Example #4
Source File: FXNodeBlinker.java    From kafka-message-tool with MIT License 6 votes vote down vote up
private void createKeyFrames() {
    if (nodeToBlink == null) {
        return;
    }



    final KeyFrame firstKeyFrame = new KeyFrame(Duration.seconds(0.01), evt -> {
        nodeToBlink.changeColor(blinkColor);
    });
    final KeyFrame secondKeyFrame = new KeyFrame(Duration.seconds(0.55), e -> {
        nodeToBlink.restoreOriginalColor();

    });
    timeline = new Timeline(firstKeyFrame,
            secondKeyFrame);

}
 
Example #5
Source File: RubikView.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public RubikView() {
    
    rubik = new Rubik();
    setCenter(rubik.getSubScene());
    
    timer = new Timeline(
        new KeyFrame(Duration.ZERO, 
            e -> clock.set(LocalTime.now().minusNanos(time.toNanoOfDay()).format(fmt))),
        new KeyFrame(Duration.seconds(1)));
    
    timer.setCycleCount(Animation.INDEFINITE);
    timeLabel = new Label();
    timeLabel.setStyle("-fx-text-fill: white; -fx-font-size: 0.9em;");
    timeLabel.textProperty().bind(clock);
    
    rubik.isSolved().addListener((ov,b,b1)->{
        if(b1){
            timer.stop();
            MobileApplication.getInstance().showMessage("Solved in " + (rubik.getCount().get() + 1) + " movements!");
        }
    });
    
    getStylesheets().add(RubikView.class.getResource("rubik.css").toExternalForm());
    addEventHandler(MouseEvent.ANY, rubik.eventHandler);
}
 
Example #6
Source File: NeuralnetInterfaceController.java    From FakeImageDetection with GNU General Public License v3.0 6 votes vote down vote up
void finalMoveOfIndicator() {
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            Timeline timeline = new Timeline();
            timeline.setCycleCount(1);

            KeyValue keyValueX = new KeyValue(navigation_button.prefWidthProperty(), 300);
            KeyFrame keyFrame = new KeyFrame(Duration.millis(2000), keyValueX);
            timeline.getKeyFrames().add(keyFrame);

            timeline.play();
            navigation_button.setStyle("-fx-background-radius: 0px;");
        }
    });
}
 
Example #7
Source File: ChartLayoutAnimator.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
/**
 * Play a animation containing the given keyframes.
 *
 * @param keyFrames The keyframes to animate
 * @return A id reference to the animation that can be used to stop the animation if needed
 */
public Object animate(KeyFrame... keyFrames) {
    Timeline t = new Timeline();
    t.setAutoReverse(false);
    t.setCycleCount(1);
    t.getKeyFrames().addAll(keyFrames);
    t.setOnFinished(this);
    // start animation timer if needed
    if (activeTimeLines.isEmpty())
        start();
    // get id and add to map
    activeTimeLines.put(t, t);
    // play animation
    t.play();
    return t;
}
 
Example #8
Source File: AbstractAxis.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
protected void updateCSS() {
    final long now = System.nanoTime();
    final double diffMillisSinceLastUpdate = TimeUnit.NANOSECONDS.toMillis(now - lastCssUpdate);
    if (diffMillisSinceLastUpdate < AbstractAxis.BURST_LIMIT_CSS_MS) {
        if (!callCssUpdater) {
            callCssUpdater = true;
            // repaint 20 ms later in case this was just a burst operation
            final KeyFrame kf1 = new KeyFrame(Duration.millis(20), e -> requestLayout());

            final Timeline timeline = new Timeline(kf1);
            Platform.runLater(timeline::play);
        }

        return;
    }
    lastCssUpdate = now;
    callCssUpdater = false;
    getMajorTickStyle().applyCss();
    getMinorTickStyle().applyCss();
    getAxisLabel().applyCss();
}
 
Example #9
Source File: JFXDialog.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
TopTransition() {
    super(contentHolder, new Timeline(
        new KeyFrame(Duration.ZERO,
            new KeyValue(contentHolder.translateYProperty(), -offsetY, Interpolator.EASE_BOTH),
            new KeyValue(JFXDialog.this.visibleProperty(), false, Interpolator.EASE_BOTH)
        ),
        new KeyFrame(Duration.millis(10),
            new KeyValue(JFXDialog.this.visibleProperty(), true, Interpolator.EASE_BOTH),
            new KeyValue(JFXDialog.this.opacityProperty(), 0, Interpolator.EASE_BOTH)
        ),
        new KeyFrame(Duration.millis(1000),
            new KeyValue(contentHolder.translateYProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(JFXDialog.this.opacityProperty(), 1, Interpolator.EASE_BOTH)))
    );
    // reduce the number to increase the shifting , increase number to reduce shifting
    setCycleDuration(Duration.seconds(0.4));
    setDelay(Duration.seconds(0));
}
 
Example #10
Source File: StrokeTransitionSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public StrokeTransitionSample() {
    super(150,150);
    Rectangle rect = new Rectangle(0, 0, 150, 150);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(null);
    rect.setStroke(Color.DODGERBLUE);
    rect.setStrokeWidth(10);
    getChildren().add(rect);
    
    strokeTransition = StrokeTransitionBuilder.create()
        .duration(Duration.seconds(3))
        .shape(rect)
        .fromValue(Color.RED)
        .toValue(Color.DODGERBLUE)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
 
Example #11
Source File: RotateTransitionSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public RotateTransitionSample() {
    super(140,140);

    Rectangle rect = new Rectangle(20, 20, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.ORANGE);
    getChildren().add(rect);
   
    rotateTransition = RotateTransitionBuilder.create()
            .node(rect)
            .duration(Duration.seconds(4))
            .fromAngle(0)
            .toAngle(720)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
Example #12
Source File: TicTacToeApp.java    From FXGLGames with MIT License 6 votes vote down vote up
private void playWinAnimation(TileCombo combo) {
    Line line = new Line();
    line.setStartX(combo.getTile1().getCenter().getX());
    line.setStartY(combo.getTile1().getCenter().getY());
    line.setEndX(combo.getTile1().getCenter().getX());
    line.setEndY(combo.getTile1().getCenter().getY());
    line.setStroke(Color.YELLOW);
    line.setStrokeWidth(3);

    getGameScene().addUINode(line);

    Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(1),
            new KeyValue(line.endXProperty(), combo.getTile3().getCenter().getX()),
            new KeyValue(line.endYProperty(), combo.getTile3().getCenter().getY())));
    timeline.setOnFinished(e -> gameOver(combo.getWinSymbol()));
    timeline.play();
}
 
Example #13
Source File: TrexApp.java    From trex-stateless-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Speeding up displaying tootlip for JDK 8 ref:
 * http://stackoverflow.com/questions/26854301/control-javafx-tooltip-delay
 */
private void speedupTooltip() {
    try {
        Tooltip tooltip = new Tooltip();
        Field fieldBehavior = tooltip.getClass().getDeclaredField("BEHAVIOR");
        fieldBehavior.setAccessible(true);
        Object objBehavior = fieldBehavior.get(tooltip);

        Field fieldTimer = objBehavior.getClass().getDeclaredField("activationTimer");
        fieldTimer.setAccessible(true);
        Timeline objTimer = (Timeline) fieldTimer.get(objBehavior);

        objTimer.getKeyFrames().clear();
        objTimer.getKeyFrames().add(new KeyFrame(new Duration(250)));
    } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
        LOG.error(e);
    }
}
 
Example #14
Source File: TransitionRotate.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 140,140));

    Rectangle rect = new Rectangle(20, 20, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.ORANGE);
    root.getChildren().add(rect);

    rotateTransition = RotateTransitionBuilder.create()
            .node(rect)
            .duration(Duration.seconds(4))
            .fromAngle(0)
            .toAngle(720)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
Example #15
Source File: TranslateTransitionSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
Example #16
Source File: Switch.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
public Switch() {
    getStylesheets().add(Switch.class.getResource("switch.css").toExternalForm());
    aspectRatio      = PREFERRED_HEIGHT / PREFERRED_WIDTH;
    _active          = false;
    _activeColor     = Tile.BLUE;
    _foregroundColor = Tile.FOREGROUND;
    _backgroundColor = Tile.BACKGROUND;

    mouseEventHandler = e -> {
        final EventType TYPE = e.getEventType();
        if (MouseEvent.MOUSE_PRESSED == TYPE) {
            setActive(!isActive());
            fireEvent(SWITCH_PRESSED);
        } else if(MouseEvent.MOUSE_RELEASED == TYPE) {
            fireEvent(SWITCH_RELEASED);
        }
    };
    selectedListener = o -> moveThumb();

    timeline = new Timeline();

    initGraphics();
    registerListeners();
}
 
Example #17
Source File: Board.java    From fx2048 with GNU General Public License v3.0 6 votes vote down vote up
public void animateScore() {
    if (gameMovePoints.get() == 0) {
        return;
    }

    final var timeline = new Timeline();
    lblPoints.setText("+" + gameMovePoints.getValue().toString());
    lblPoints.setOpacity(1);

    double posX = vScore.localToScene(vScore.getWidth() / 2d, 0).getX();
    lblPoints.setTranslateX(0);
    lblPoints.setTranslateX(lblPoints.sceneToLocal(posX, 0).getX() - lblPoints.getWidth() / 2d);
    lblPoints.setLayoutY(20);

    final var kvO = new KeyValue(lblPoints.opacityProperty(), 0);
    final var kvY = new KeyValue(lblPoints.layoutYProperty(), 100);

    var animationDuration = Duration.millis(600);
    final KeyFrame kfO = new KeyFrame(animationDuration, kvO);
    final KeyFrame kfY = new KeyFrame(animationDuration, kvY);

    timeline.getKeyFrames().add(kfO);
    timeline.getKeyFrames().add(kfY);

    timeline.play();
}
 
Example #18
Source File: FadeTransitionSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public FadeTransitionSample() {
    super(100,100);
    Rectangle rect = new Rectangle(0, 0, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.DODGERBLUE);
    getChildren().add(rect);
    
    fadeTransition = FadeTransitionBuilder.create()
        .duration(Duration.seconds(4))
        .node(rect)
        .fromValue(1)
        .toValue(0.2)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
 
Example #19
Source File: Notifications.java    From yfiton with Apache License 2.0 6 votes vote down vote up
private Timeline createHideTimeline(final Popup popup, NotificationBar bar, final Pos p, Duration startDelay, Notifications notification) {
    KeyValue fadeOutBegin = new KeyValue(bar.opacityProperty(), 1.0);
    KeyValue fadeOutEnd = new KeyValue(bar.opacityProperty(), 0.0);

    KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
    KeyFrame kfEnd = new KeyFrame(Duration.millis(500), fadeOutEnd);

    Timeline timeline = new Timeline(kfBegin, kfEnd);
    timeline.setDelay(startDelay);
    timeline.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            hide(popup, p);
            notification.onHideAction.handle(e);
        }
    });

    return timeline;
}
 
Example #20
Source File: SplitFlapSkin.java    From Enzo with Apache License 2.0 6 votes vote down vote up
public SplitFlapSkin(final SplitFlap CONTROL) {
    super(CONTROL);
    FLIP_FINISHED         = new FlipEvent(this, getSkinnable(), FlipEvent.FLIP_FINISHED);
    selectedSet           = getSkinnable().getSelectedSet();
    currentSelectionIndex = getSkinnable().getSelectedSet().indexOf(getSkinnable().getText());
    nextSelectionIndex    = currentSelectionIndex + 1 > getSkinnable().getSelectedSet().size() ? 0 : currentSelectionIndex + 1;
    aspectRatio           = PREFERRED_HEIGHT / PREFERRED_WIDTH;
    pane                  = new Pane();
    rotateFlap            = new Rotate();
    rotateFlap.setAxis(Rotate.X_AXIS);
    rotateFlap.setAngle(0);
    flapHeight            = 0.49206349206349204 * PREFERRED_HEIGHT;
    timeline              = new Timeline();
    init();
    initGraphics();
    registerListeners();
}
 
Example #21
Source File: TranslateTransitionSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
Example #22
Source File: SpinnerController.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #23
Source File: AdminAddUserViewController.java    From Corendon-LostLuggage with MIT License 6 votes vote down vote up
public void startAnimation() {
    errorMessageView.prefHeight(0.0d);
    mainBorderPane.setTop(errorMessageView);
    errorMessageHBox.getChildren().add(errorMessageLbl);
    errorMessageLbl.setVisible(true);

    Timeline timeline = new Timeline();
    timeline.getKeyFrames().addAll(new KeyFrame(Duration.ZERO,
            new KeyValue(errorMessageView.prefHeightProperty(), 0)
    ),
            new KeyFrame(Duration.millis(300.0d),
                    new KeyValue(errorMessageView.prefHeightProperty(), navListPrefHeight)
            )
    );
    addUserBtn.setDisable(true);
    timeline.play();

    PauseTransition wait = new PauseTransition(Duration.seconds(4));
    wait.setOnFinished((e) -> {
        dismissAnimation();
    });
    wait.play();

}
 
Example #24
Source File: DataAppPreloader.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override public void handleStateChangeNotification(StateChangeNotification evt) {
    if (evt.getType() == StateChangeNotification.Type.BEFORE_INIT) {
        // check if download was crazy fast and restart progress
        if ((System.currentTimeMillis() - startDownload) < 500) {
            raceTrack.setProgress(0);
        }
        // we have finished downloading application, now we are running application
        // init() method, as we have no way of calculating real progress 
        // simplate pretend progress here
        simulatorTimeline = new Timeline();
        simulatorTimeline.getKeyFrames().add( 
                new KeyFrame(Duration.seconds(3), 
                        new KeyValue(raceTrack.progressProperty(),1)
                )
        );
        simulatorTimeline.play();
    }
}
 
Example #25
Source File: DataAppPreloader.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) throws Exception {
    preloaderStage = stage;
    preloaderStage.setScene(preloaderScene);
    preloaderStage.show();
    
    if (DEMO_MODE) {
        final DoubleProperty prog = new SimpleDoubleProperty(0){
            @Override protected void invalidated() {
                handleProgressNotification(new ProgressNotification(get()));
            }
        };
        Timeline t = new Timeline();
        t.getKeyFrames().add(new KeyFrame(Duration.seconds(20), new KeyValue(prog, 1)));
        t.play();
    }
}
 
Example #26
Source File: AutoScrollingWindow.java    From graph-editor with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Starts the auto-scrolling.
 */
private void startScrolling() {

    isScrolling = true;
    jumpsTaken = 0;

    final KeyFrame frame = new KeyFrame(Duration.millis(parameters.getJumpPeriod()), event -> {
        if (dragEventTarget != null && isScrolling && jumpDistance != null) {
            panBy(jumpDistance.getX(), jumpDistance.getY());
            dragEventTarget.fireEvent(currentDragEvent);
            jumpsTaken++;
        }
    });

    timeline = new Timeline();
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.getKeyFrames().add(frame);
    timeline.play();
}
 
Example #27
Source File: Viewer3DFX.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
public void setAffine(final Affine affine, final Duration duration) {
	if (duration.toMillis() == 0.0) {
		setAffine(affine);
		return;
	}
	final Timeline timeline = new Timeline(60.0);
	timeline.setCycleCount(1);
	timeline.setAutoReverse(false);
	final Affine currentState = new Affine();
	getAffine(currentState);
	final DoubleProperty progressProperty = new SimpleDoubleProperty(0.0);
	final SimilarityTransformInterpolator interpolator = new SimilarityTransformInterpolator(
			Transforms.fromTransformFX(currentState),
			Transforms.fromTransformFX(affine)
		);
	progressProperty.addListener((obs, oldv, newv) -> setAffine(Transforms.toTransformFX(interpolator.interpolateAt(newv.doubleValue()))));
	final KeyValue kv = new KeyValue(progressProperty, 1.0, Interpolator.EASE_BOTH);
	timeline.getKeyFrames().add(new KeyFrame(duration, kv));
	timeline.play();
}
 
Example #28
Source File: TicTacToeApp.java    From FXGLGames with MIT License 6 votes vote down vote up
@Override
protected void initUI() {
    Line line1 = new Line(getAppWidth() / 3, 0, getAppWidth() / 3, 0);
    Line line2 = new Line(getAppWidth() / 3 * 2, 0, getAppWidth() / 3 * 2, 0);
    Line line3 = new Line(0, getAppHeight() / 3, 0, getAppHeight() / 3);
    Line line4 = new Line(0, getAppHeight() / 3 * 2, 0, getAppHeight() / 3 * 2);

    getGameScene().addUINodes(line1, line2, line3, line4);

    // animation
    KeyFrame frame1 = new KeyFrame(Duration.seconds(0.5),
            new KeyValue(line1.endYProperty(), getAppHeight()));

    KeyFrame frame2 = new KeyFrame(Duration.seconds(1),
            new KeyValue(line2.endYProperty(), getAppHeight()));

    KeyFrame frame3 = new KeyFrame(Duration.seconds(0.5),
            new KeyValue(line3.endXProperty(), getAppWidth()));

    KeyFrame frame4 = new KeyFrame(Duration.seconds(1),
            new KeyValue(line4.endXProperty(), getAppWidth()));

    Timeline timeline = new Timeline(frame1, frame2, frame3, frame4);
    timeline.play();
}
 
Example #29
Source File: MainViewController.java    From JavaFX-Tutorial-Codes with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(URL url, ResourceBundle rb) {
    timeline = new Timeline();
    KeyFrame keyFrame = new KeyFrame(Duration.millis(Constants.TEXT_INTERVAL), (ActionEvent event) -> {
        handleText();
    });
    timeline.getKeyFrames().add(keyFrame);
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
 
Example #30
Source File: FadeInRightBig.java    From AnimateFX with Apache License 2.0 5 votes vote down vote up
@Override
void initTimeline() {
    setTimeline(new Timeline(

            new KeyFrame(Duration.millis(0),
                    new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().translateXProperty(), 2000, AnimateFXInterpolator.EASE)

            ),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE)
            )
    ));
}