javafx.animation.KeyFrame Java Examples

The following examples show how to use javafx.animation.KeyFrame. 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: 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 #2
Source File: TemporaryDateAxis.java    From Open-Lowcode with Eclipse Public License 2.0 7 votes vote down vote up
@Override
protected void setRange(Object range, boolean animating) {
	Object[] r = (Object[]) range;
	Date oldLowerBound = getLowerBound();
	Date oldUpperBound = getUpperBound();
	Date lower = (Date) r[0];
	Date upper = (Date) r[1];
	lowerBound.set(lower);
	upperBound.set(upper);

	if (animating) {

		animator.stop(currentAnimationID);
		currentAnimationID = animator.animate(
				new KeyFrame(Duration.ZERO, new KeyValue(currentLowerBound, oldLowerBound.getTime()),
						new KeyValue(currentUpperBound, oldUpperBound.getTime())),
				new KeyFrame(Duration.millis(700), new KeyValue(currentLowerBound, lower.getTime()),
						new KeyValue(currentUpperBound, upper.getTime())));

	} else {
		currentLowerBound.set(getLowerBound().getTime());
		currentUpperBound.set(getUpperBound().getTime());
	}
}
 
Example #3
Source File: RotateInUpRight.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    getNode().setRotationAxis(Rotate.Z_AXIS);
    Rotate rotate = new Rotate(0, getNode().getBoundsInLocal().getWidth(), getNode().getBoundsInLocal().getHeight());
    getNode().getTransforms().add(rotate);
    setTimeline(new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(rotate.angleProperty(), -45, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE)
            )
    ));
}
 
Example #4
Source File: Board.java    From util4j with Apache License 2.0 7 votes vote down vote up
public void animateScore() {
    if(gameMovePoints.get()==0){
        return;
    }
    
    final Timeline 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 KeyValue kvO = new KeyValue(lblPoints.opacityProperty(), 0);
    final KeyValue kvY = new KeyValue(lblPoints.layoutYProperty(), 100);

    Duration 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 #5
Source File: Chart.java    From chart-fx with Apache License 2.0 7 votes vote down vote up
protected void registerShowingListener() {
    sceneProperty().addListener(scenePropertyListener);

    showing.addListener((ch, o, n) -> {
        if (n.equals(n)) {
            return;
        }
        if (Boolean.TRUE.equals(n)) {
            // requestLayout();

            // alt implementation in case of start-up issues
            final KeyFrame kf1 = new KeyFrame(Duration.millis(20), e -> requestLayout());

            final Timeline timeline = new Timeline(kf1);
            Platform.runLater(timeline::play);
        }
    });
}
 
Example #6
Source File: JackInTheBox.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    Rotate rotate = new Rotate(30, getNode().getBoundsInParent().getWidth() / 2, getNode().getBoundsInParent().getHeight());
    getNode().getTransforms().add(rotate);
    setTimeline(new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(rotate.angleProperty(), 30, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(500),
                    new KeyValue(rotate.angleProperty(), -10, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(700),
                    new KeyValue(rotate.angleProperty(), 3, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE)
            )
    ));
}
 
Example #7
Source File: ZoomOperator.java    From PDF4Teachers with Apache License 2.0 7 votes vote down vote up
public void scrollDown(int factor, boolean removeTransition){
    if(!isPlaying){
        aimTranslateY = pane.getTranslateY();
        aimTranslateX = pane.getTranslateX();
        aimScale = pane.getScaleX();
    }

    double newTranslateY = aimTranslateY - factor;
    if(newTranslateY - getPaneShiftY() < -getScrollableHeight()) newTranslateY = -getScrollableHeight() + getPaneShiftY();

    aimTranslateY = newTranslateY;

    if(Main.settings.isZoomAnimations() && factor > 25 && !removeTransition){
        timeline.getKeyFrames().clear();
        timeline.getKeyFrames().addAll(
                new KeyFrame(Duration.millis(200), new KeyValue(pane.translateYProperty(), aimTranslateY))
        );
        timeline.stop();
        isPlaying = true;
        timeline.play();

    }else{
        pane.setTranslateY(aimTranslateY);
    }
}
 
Example #8
Source File: ZoomOperator.java    From PDF4Teachers with Apache License 2.0 7 votes vote down vote up
public void scrollRight(int factor, boolean removeTransition){
    if(!isPlaying){
        aimTranslateY = pane.getTranslateY();
        aimTranslateX = pane.getTranslateX();
        aimScale = pane.getScaleX();
    }

    double newTranslateX = aimTranslateX - factor;
    if(newTranslateX - getPaneShiftX() < -getScrollableWidth()) newTranslateX = -getScrollableWidth() + getPaneShiftX();

    aimTranslateX = newTranslateX;

    if(Main.settings.isZoomAnimations() && factor > 25 && !removeTransition){
        timeline.getKeyFrames().clear();
        timeline.getKeyFrames().addAll(
                new KeyFrame(Duration.millis(200), new KeyValue(pane.translateXProperty(), newTranslateX))
        );
        timeline.stop();
        isPlaying = true;
        timeline.play();
    }else{
        pane.setTranslateX(newTranslateX);
    }
}
 
Example #9
Source File: ZoomOperator.java    From PDF4Teachers with Apache License 2.0 7 votes vote down vote up
public void scrollLeft(int factor, boolean removeTransition){
    if(!isPlaying){
        aimTranslateY = pane.getTranslateY();
        aimTranslateX = pane.getTranslateX();
        aimScale = pane.getScaleX();
    }

    double newTranslateX = aimTranslateX + factor;
    if(newTranslateX - getPaneShiftX() > 0) newTranslateX = getPaneShiftX();

    aimTranslateX = newTranslateX;

    if(Main.settings.isZoomAnimations() && factor > 25 && !removeTransition){
        timeline.getKeyFrames().clear();
        timeline.getKeyFrames().addAll(
                new KeyFrame(Duration.millis(200), new KeyValue(pane.translateXProperty(), aimTranslateX))
        );
        timeline.stop();
        isPlaying = true;
        timeline.play();

    }else{
        pane.setTranslateX(aimTranslateX);
    }
}
 
Example #10
Source File: ZoomInLeft.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    setTimeline(new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(getNode().translateXProperty(), -1000, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
                    new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
                    new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
                    new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
                    new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19))
            ),
            new KeyFrame(Duration.millis(400),
                    new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().translateXProperty(), 10, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1))
            ),
            new KeyFrame(Duration.millis(1100),
                    new KeyValue(getNode().translateXProperty(), 0, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1))
            )
    ));
}
 
Example #11
Source File: FadeInRightBigTransition.java    From oim-fx with MIT License 7 votes vote down vote up
@Override protected void starting() {
    double startX = node.getScene().getWidth() - node.localToScene(0, 0).getX();
    timeline = TimelineBuilder.create()
            .keyFrames(
                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)
                )
            )
            .build();
    super.starting();
}
 
Example #12
Source File: FadeInLeftTransition.java    From oim-fx with MIT License 7 votes vote down vote up
/**
 * Create new FadeInLeftTransition
 * 
 * @param node The node to affect
 */
public FadeInLeftTransition(final Node node) {
    super(
        node,
        TimelineBuilder.create()
            .keyFrames(
                new KeyFrame(Duration.millis(0),    
                    new KeyValue(node.opacityProperty(), 0, WEB_EASE),
                    new KeyValue(node.translateXProperty(), -20, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(1000),    
                    new KeyValue(node.opacityProperty(), 1, WEB_EASE),
                    new KeyValue(node.translateXProperty(), 0, WEB_EASE)
                )
            )
            .build()
        );
    setCycleDuration(Duration.seconds(1));
    setDelay(Duration.seconds(0.2));
}
 
Example #13
Source File: ZoomOutLeft.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    setTimeline(new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(400),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().translateXProperty(), 42, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(1100),
                    new KeyValue(getNode().translateXProperty(), -2000, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE)
            )
    ));
}
 
Example #14
Source File: FadeInUp.java    From AnimateFX with Apache License 2.0 7 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().translateYProperty(), getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE)

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

            )

    ));
}
 
Example #15
Source File: ZoomOutUp.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    setTimeline(new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(400),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().translateYProperty(), 60, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(getNode().translateYProperty(), -600, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE)
            )
    ));
}
 
Example #16
Source File: FlipTileSkin.java    From OEE-Designer with MIT License 7 votes vote down vote up
private void flipForward() {
    timeline.stop();

    flap.setCache(true);
    flap.setCacheHint(CacheHint.ROTATE);
    //flap.setCacheHint(CacheHint.SPEED);

    currentSelectionIndex++;
    if (currentSelectionIndex >= characters.size()) {
        currentSelectionIndex = 0;
    }
    nextSelectionIndex = currentSelectionIndex + 1;
    if (nextSelectionIndex >= characters.size()) {
        nextSelectionIndex = 0;
    }
    KeyValue keyValueFlap = new KeyValue(rotateFlap.angleProperty(), 180, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
    //KeyValue keyValueFlap = new KeyValue(rotateFlap.angleProperty(), 180, Interpolator.EASE_IN);
    KeyFrame keyFrame     = new KeyFrame(Duration.millis(tile.getFlipTimeInMS()), keyValueFlap);
    timeline.getKeyFrames().setAll(keyFrame);
    timeline.play();
}
 
Example #17
Source File: Clock.java    From Quelea with GNU General Public License v3.0 7 votes vote down vote up
private void bindToTime() {
    Timeline timeline = new Timeline(
            new KeyFrame(Duration.seconds(0), (ActionEvent actionEvent) -> {
                Calendar time = Calendar.getInstance();
                String hourString;
                boolean s24h = QueleaProperties.get().getUse24HourClock();
                if (s24h) {
                    hourString = pad(2, '0', time.get(Calendar.HOUR_OF_DAY) + "");
                } else {
                    hourString = pad(2, '0', time.get(Calendar.HOUR) + "");
                }
                String minuteString = pad(2, '0', time.get(Calendar.MINUTE) + "");
                String text1 = hourString + ":" + minuteString;
        if (!s24h) {
            text1 += (time.get(Calendar.AM_PM) == Calendar.AM) ? " AM" : " PM";
        }
        setText(text1);
    }),
            new KeyFrame(Duration.seconds(1))
    );
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
 
Example #18
Source File: GlobalTransformManager.java    From paintera with GNU General Public License v2.0 7 votes vote down vote up
public synchronized void setTransform(final AffineTransform3D affine, final Duration duration) {
	if (duration.toMillis() == 0.0) {
		setTransform(affine);
		return;
	}
	final Timeline timeline = new Timeline(60.0);
	timeline.setCycleCount(1);
	timeline.setAutoReverse(false);
	final AffineTransform3D currentState = this.affine.copy();
	final DoubleProperty progressProperty = new SimpleDoubleProperty(0.0);
	final SimilarityTransformInterpolator interpolator = new SimilarityTransformInterpolator(currentState, affine.copy());
	progressProperty.addListener((obs, oldv, newv) -> setTransform(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 #19
Source File: KeyStrokeMotion.java    From netbeans 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 #20
Source File: Scene1Controller.java    From JavaFX-Tutorial-Codes with Apache License 2.0 7 votes vote down vote up
@FXML
private void loadSecond(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/javafx/scene/transition/scene2/scene2.fxml"));
    Scene scene = button.getScene();
    root.translateYProperty().set(scene.getHeight());

    parentContainer.getChildren().add(root);

    Timeline timeline = new Timeline();
    KeyValue kv = new KeyValue(root.translateYProperty(), 0, Interpolator.EASE_IN);
    KeyFrame kf = new KeyFrame(Duration.seconds(1), kv);
    timeline.getKeyFrames().add(kf);
    timeline.setOnFinished(t -> {
        parentContainer.getChildren().remove(anchorRoot);
    });
    timeline.play();
}
 
Example #21
Source File: FadeInRight.java    From AnimateFX with Apache License 2.0 7 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(), getNode().getBoundsInParent().getWidth(), AnimateFXInterpolator.EASE)

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

            )

    ));
}
 
Example #22
Source File: BounceInUp.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    double startY = getNode().getScene().getHeight() - getNode().localToScene(0, 0).getY();
    setTimeline( new Timeline(
                    new KeyFrame(Duration.millis(0),
                            new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)),
                            new KeyValue(getNode().translateYProperty(), startY, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000))
                    ),
                    new KeyFrame(Duration.millis(600),
                            new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000)),
                            new KeyValue(getNode().translateYProperty(), -20, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000))
                    ),
                    new KeyFrame(Duration.millis(750),
                            new KeyValue(getNode().translateYProperty(), 10, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000))
                    ),
                    new KeyFrame(Duration.millis(900),
                            new KeyValue(getNode().translateYProperty(), -5, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000))
                    ),
                    new KeyFrame(Duration.millis(1000),
                            new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.215, 0.610, 0.355, 1.000))
                    )

            ));
}
 
Example #23
Source File: ZoomInRight.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    setTimeline(new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(getNode().translateXProperty(), 1000, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
                    new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
                    new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
                    new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
                    new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19))
            ),
            new KeyFrame(Duration.millis(400),
                    new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().translateXProperty(), -10, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1))
            ),
            new KeyFrame(Duration.millis(1100),
                    new KeyValue(getNode().translateXProperty(), 0, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
                    new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1))
            )
    ));
}
 
Example #24
Source File: RotateInUpLeft.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    getNode().setRotationAxis(Rotate.Z_AXIS);
    Rotate rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight());
    getNode().getTransforms().add(rotate);
    setTimeline(new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(rotate.angleProperty(), 45, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE)
            )
    ));
}
 
Example #25
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 #26
Source File: DataAppPreloader.java    From marathonv5 with Apache License 2.0 7 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 #27
Source File: ChartAdvancedStockLine.java    From netbeans with Apache License 2.0 7 votes vote down vote up
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    root.getChildren().add(createChart());
    // create timeline to add new data every 60th of second
    animation = new Timeline();
    animation.getKeyFrames().add(new KeyFrame(Duration.millis(1000/60), new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            // 6 minutes data per frame
            for(int count=0; count < 6; count++) {
                nextTime();
                plotTime();
            }
        }
    }));
    animation.setCycleCount(Animation.INDEFINITE);
}
 
Example #28
Source File: RotateInDownRight.java    From AnimateFX with Apache License 2.0 7 votes vote down vote up
@Override
void initTimeline() {
    getNode().setRotationAxis(Rotate.Z_AXIS);
    Rotate rotate = new Rotate(0, getNode().getBoundsInLocal().getWidth(), getNode().getBoundsInLocal().getHeight());
    getNode().getTransforms().add(rotate);
    setTimeline(new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(rotate.angleProperty(), 45, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE)
            ),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE),
                    new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE)
            )
    ));
}
 
Example #29
Source File: AbstractAxis.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
protected void setRange(final AxisRange rangeObj, final boolean animate) {
    final AxisRange range = rangeObj;
    final double oldLowerBound = getMin();
    set(range.getLowerBound(), range.getUpperBound());

    if (animate) {
        animator.stop();
        animator.getKeyFrames()
                .setAll(new KeyFrame(Duration.ZERO, new KeyValue(currentLowerBound, oldLowerBound),
                                new KeyValue(scaleBinding, getScale())),
                        new KeyFrame(Duration.millis(AbstractAxis.RANGE_ANIMATION_DURATION_MS),
                                new KeyValue(currentLowerBound, range.getLowerBound()),
                                new KeyValue(scaleBinding, range.getScale())));
        animator.play();
    } else {
        currentLowerBound.set(range.getLowerBound());
        setScale(range.getScale());
    }
}
 
Example #30
Source File: SpriteView.java    From quantumjava with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void startAnimation() {
    Timeline timeline = new Timeline(Animation.INDEFINITE,
        new KeyFrame(Duration.seconds(.25), new KeyValue(frame, 0)),
        new KeyFrame(Duration.seconds(.5), new KeyValue(frame, 1)),
        new KeyFrame(Duration.seconds(.75), new KeyValue(frame, 2)),
        new KeyFrame(Duration.seconds(1), new KeyValue(frame, 1))
    );
    timeline.onFinishedProperty().setValue(e -> timeline.play());
    timeline.play();
}