Java Code Examples for javafx.animation.Interpolator#SPLINE

The following examples show how to use javafx.animation.Interpolator#SPLINE . 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: 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 2
Source File: FlipTileSkin.java    From tilesfx with Apache License 2.0 6 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 3
Source File: PeerInfoWithTagEditor.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void animateDisplay() {
    if (GlobalSettings.getUseAnimations()) {
        double startY = -160;
        double duration = getDuration(400);
        Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
        Timeline timeline = new Timeline();
        ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
        keyFrames.add(new KeyFrame(Duration.millis(0),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                new KeyValue(gridPane.translateYProperty(), startY, interpolator)
        ));

        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                new KeyValue(gridPane.translateYProperty(), 0, interpolator)
        ));

        timeline.play();
    }
}
 
Example 4
Source File: RadialBargraphSkin.java    From Enzo with Apache License 2.0 6 votes vote down vote up
private void setBar() {
    double range       = (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double angleRange  = getSkinnable().getAngleRange();
    angleStep          = angleRange / range;
    double targetAngle = getSkinnable().getValue() * angleStep;

    if (getSkinnable().isAnimated()) {
        timeline.stop();
        final KeyValue KEY_VALUE = new KeyValue(angle, targetAngle, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
        final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
        timeline.getKeyFrames().setAll(KEY_FRAME);
        timeline.play();
    } else {
        angle.set(targetAngle);
    }
}
 
Example 5
Source File: GaugeSkin.java    From Enzo with Apache License 2.0 6 votes vote down vote up
private void rotateNeedle() {
    double range       = (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double angleRange  = getSkinnable().getAngleRange();
    angleStep          = angleRange / range;
    double targetAngle = needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue()) * angleStep;

    if (getSkinnable().isAnimated()) {
        timeline.stop();
        //double animationDuration = (getSkinnable().getAnimationDuration() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue())) * Math.abs(getSkinnable().getValue() - getSkinnable().getOldValue());
        final KeyValue KEY_VALUE = new KeyValue(needleRotate.angleProperty(), targetAngle, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
        final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
        timeline.getKeyFrames().setAll(KEY_FRAME);
        timeline.play();
    } else {
        needleRotate.setAngle(targetAngle);
    }
}
 
Example 6
Source File: Notification.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void animateHide(Runnable onFinishedHandler) {
    if (autoCloseTimer != null) {
        autoCloseTimer.stop();
        autoCloseTimer = null;
    }

    if (NotificationCenter.useAnimations) {
        double duration = getDuration(400);
        Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);

        gridPane.setRotationAxis(Rotate.X_AXIS);
        Camera camera = gridPane.getScene().getCamera();
        gridPane.getScene().setCamera(new PerspectiveCamera());

        Timeline timeline = new Timeline();
        ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
        keyFrames.add(new KeyFrame(Duration.millis(0),
                new KeyValue(gridPane.rotateProperty(), 0, interpolator),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator)
        ));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.rotateProperty(), -90, interpolator),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator)
        ));
        timeline.setOnFinished(event -> {
            gridPane.setRotate(0);
            gridPane.setRotationAxis(Rotate.Z_AXIS);
            gridPane.getScene().setCamera(camera);
            onFinishedHandler.run();
        });
        timeline.play();
    } else {
        onFinishedHandler.run();
    }
}
 
Example 7
Source File: Notification.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void animateDisplay() {
    if (NotificationCenter.useAnimations) {
        double startX = 320;
        double duration = getDuration(600);
        Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);

        Timeline timeline = new Timeline();
        ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
        keyFrames.add(new KeyFrame(Duration.millis(0),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                new KeyValue(gridPane.translateXProperty(), startX, interpolator)
        ));
        //bouncing
     /*   keyFrames.add(new KeyFrame(Duration.millis(duration * 0.6),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                new KeyValue(gridPane.translateXProperty(), -12, interpolator)
        ));
        keyFrames.add(new KeyFrame(Duration.millis(duration * 0.8),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                new KeyValue(gridPane.translateXProperty(), 4, interpolator)
        ));*/
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                new KeyValue(gridPane.translateXProperty(), 0, interpolator)
        ));

        timeline.play();
    }
}
 
Example 8
Source File: PeerInfoWithTagEditor.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void animateHide(Runnable onFinishedHandler) {
    if (GlobalSettings.getUseAnimations()) {
        double duration = getDuration(300);
        Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);

        gridPane.setRotationAxis(Rotate.X_AXIS);
        Camera camera = gridPane.getScene().getCamera();
        gridPane.getScene().setCamera(new PerspectiveCamera());

        Timeline timeline = new Timeline();
        ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
        keyFrames.add(new KeyFrame(Duration.millis(0),
                new KeyValue(gridPane.rotateProperty(), 0, interpolator),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator)
        ));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.rotateProperty(), -90, interpolator),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator)
        ));
        timeline.setOnFinished(event -> {
            gridPane.setRotate(0);
            gridPane.setRotationAxis(Rotate.Z_AXIS);
            gridPane.getScene().setCamera(camera);
            onFinishedHandler.run();
        });
        timeline.play();
    } else {
        onFinishedHandler.run();
    }
}
 
Example 9
Source File: SimpleGaugeSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void rotateNeedle() {
    angleStep          = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double targetAngle = needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue()) * angleStep;
    targetAngle        = clamp(180 - getSkinnable().getStartAngle(), 180 - getSkinnable().getStartAngle() + getSkinnable().getAngleRange(), targetAngle);
    
    if (getSkinnable().isAnimated()) {
        timeline.stop();            
        final KeyValue KEY_VALUE = new KeyValue(needleRotate.angleProperty(), targetAngle, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
        final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
        timeline.getKeyFrames().setAll(KEY_FRAME);
        timeline.play();
    } else {
        needleRotate.setAngle(targetAngle);
    }
}
 
Example 10
Source File: ClockSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void moveMinutePointer(double newAngle) {
    final KeyValue kv = new KeyValue(currentMinuteAngle, newAngle, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
    final KeyFrame kf = new KeyFrame(Duration.millis(200), kv);
    timeline = new Timeline();
    timeline.getKeyFrames().add(kf);
    timeline.play();
}