javafx.animation.Interpolator Java Examples

The following examples show how to use javafx.animation.Interpolator. 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: AndroidKeyboardService.java    From attach with GNU General Public License v3.0 7 votes vote down vote up
private static void adjustPosition(Node node, Parent parent, double kh) {
    if (node == null || node.getScene() == null || node.getScene().getWindow() == null) {
        return;
    }
    double tTot = node.getScene().getHeight();
    double ty = node.getLocalToSceneTransform().getTy() + node.getBoundsInParent().getHeight() + 2;
    double y = 1;
    Parent root = parent == null ? node.getScene().getRoot() : parent;
    if (ty > tTot - kh) {
        y = tTot - ty - kh;
    } else if (kh == 0 && root.getTranslateY() != 0) {
        y = 0;
    }
    if (y <= 0) {
        if (debug) {
            LOG.log(Level.INFO, String.format("Moving %s %.2f pixels", root, y));
        }
        final TranslateTransition transition = new TranslateTransition(Duration.millis(100), root);
        transition.setFromY(root.getTranslateY());
        transition.setToY(y);
        transition.setInterpolator(Interpolator.EASE_OUT);
        transition.playFromStart();
    }
}
 
Example #2
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 #3
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 #4
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 #5
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 #6
Source File: ChartData.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
public void setDuration(final java.time.Duration DURATION) {
    if (animated) {
        oldDuration = duration;
        duration    = DURATION;
        timeline.stop();
        KeyValue kv1 = new KeyValue(currentDuration, oldDuration, Interpolator.EASE_BOTH);
        KeyValue kv2 = new KeyValue(currentDuration, DURATION, Interpolator.EASE_BOTH);
        KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
        KeyFrame kf2 = new KeyFrame(Duration.millis(animationDuration), kv2);
        timeline.getKeyFrames().setAll(kf1, kf2);
        timeline.play();
    } else {
        oldDuration = duration;
        duration    = DURATION;
        fireChartDataEvent(FINISHED_EVENT);
    }
}
 
Example #7
Source File: LogLine.java    From LogFX with GNU General Public License v3.0 6 votes vote down vote up
BackgroundTransition( Color targetColor ) {
    List<BackgroundFill> fills = getBackground().getFills();
    if ( !fills.isEmpty() && fills.get( 0 ).getFill() instanceof Color ) {
        this.originalColor = ( Color ) fills.get( 0 ).getFill();
    } else {
        this.originalColor = targetColor.invert();
    }

    if ( targetColor.equals( originalColor ) ) {
        this.targetColor = targetColor.invert();
    } else {
        this.targetColor = targetColor;
    }

    setCycleDuration( Duration.millis( 650 ) );
    setInterpolator( Interpolator.EASE_OUT );
    setCycleCount( 6 );
    setAutoReverse( true );
    setOnFinished( event -> setBackground( FxUtils.simpleBackground( originalColor ) ) );
}
 
Example #8
Source File: TestCaseListCell.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Animation getStatusTransition(TestStatus newStatus) {

        return new Transition() {

            {
                setCycleDuration(Duration.millis(1200));
                setInterpolator(Interpolator.EASE_BOTH);
                setOnFinished(t -> applyCss());
            }


            @Override
            protected void interpolate(double frac) {
                Color vColor = newStatus.getColor().deriveColor(0, 1, 1, clip(map(frac)));
                setBackground(new Background(new BackgroundFill(vColor, CornerRadii.EMPTY, Insets.EMPTY)));
            }

            private double map(double x) {
                return -abs(x - 0.5) + 0.5;
            }

            private double clip(double i) {
                return min(1, max(0, i));
            }
        };
    }
 
Example #9
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 #10
Source File: GameManager.java    From util4j with Apache License 2.0 6 votes vote down vote up
/**
 * Animation that moves the tile from its previous location to a new location 
 * @param tile to be animated
 * @param newLocation new location of the tile
 * @return a timeline 
 */
private Timeline animateExistingTile(Tile tile, Location newLocation) {
    Timeline timeline = new Timeline();
    KeyValue kvX = new KeyValue(tile.layoutXProperty(),
            newLocation.getLayoutX(Board.CELL_SIZE) - (tile.getMinHeight() / 2), Interpolator.EASE_OUT);
    KeyValue kvY = new KeyValue(tile.layoutYProperty(),
            newLocation.getLayoutY(Board.CELL_SIZE) - (tile.getMinHeight() / 2), Interpolator.EASE_OUT);

    KeyFrame kfX = new KeyFrame(ANIMATION_EXISTING_TILE, kvX);
    KeyFrame kfY = new KeyFrame(ANIMATION_EXISTING_TILE, kvY);

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

    return timeline;
}
 
Example #11
Source File: TimelineInterpolator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private Circle createMovingCircle(Interpolator interpolator) {
    //create a transparent circle
    Circle circle = new Circle(45,45, 40,  Color.web("1c89f4"));
    circle.setOpacity(0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
   
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
 
Example #12
Source File: TimelineInterpolator.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, 250, 90));

    //create circles by method createMovingCircle listed below
    Circle circle1 = createMovingCircle(Interpolator.LINEAR); //default interpolator
    circle1.setOpacity(0.7);
    Circle circle2 = createMovingCircle(Interpolator.EASE_BOTH); //circle slows down when reached both ends of trajectory
    circle2.setOpacity(0.45);
    Circle circle3 = createMovingCircle(Interpolator.EASE_IN);
    Circle circle4 = createMovingCircle(Interpolator.EASE_OUT);
    Circle circle5 = createMovingCircle(Interpolator.SPLINE(0.5, 0.1, 0.1, 0.5)); //one can define own behaviour of interpolator by spline method
    
    root.getChildren().addAll(
            circle1,
            circle2,
            circle3,
            circle4,
            circle5
    );
}
 
Example #13
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 #14
Source File: BounceInDown.java    From AnimateFX with Apache License 2.0 6 votes vote down vote up
@Override
void initTimeline() {
    this.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(), -3000, 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(), 25, 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 #15
Source File: NotificationPane.java    From FXTutorials with MIT License 6 votes vote down vote up
public NotificationPane(int w, int h) {
    this.w = w;
    this.h = h;

    bg = new Rectangle(w, h, Color.color(0.2, 0.2, 0.2, 0.75));

    getChildren().add(bg);

    tt.setOnFinished(e -> isAnimating = false);

    tt.setInterpolator(new Interpolator() {
        @Override
        protected double curve(double t) {
            //return (t == 0.0) ? 0.0 : Math.pow(2.0, 10 * (t - 1));
            return (t == 1.0) ? 1.0 : 1 - Math.pow(2.0, -10 * t);
        }
    });
}
 
Example #16
Source File: Scene2Controller.java    From JavaFX-Tutorial-Codes with Apache License 2.0 6 votes vote down vote up
@FXML
private void loadThird(ActionEvent event) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("/javafx/scene/transition/scene3/scene3.fxml"));
    Scene scene = button.getScene();
    root.translateXProperty().set(scene.getWidth());

    StackPane parentContainer = (StackPane) button.getScene().getRoot();

    parentContainer.getChildren().add(root);

    Timeline timeline = new Timeline();
    KeyValue kv = new KeyValue(root.translateXProperty(), 0, Interpolator.EASE_IN);
    KeyFrame kf = new KeyFrame(Duration.seconds(1), kv);
    timeline.getKeyFrames().add(kf);
    timeline.setOnFinished(t -> {
        parentContainer.getChildren().remove(container);
    });
    timeline.play();
}
 
Example #17
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 #18
Source File: DaoLaunchWindow.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void createSlideAnimation(Timeline timeline, double imageWidth) {
    Interpolator interpolator = Interpolator.EASE_OUT;
    ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();

    double endX = -imageWidth;
    keyFrames.add(new KeyFrame(Duration.millis(0),
            new KeyValue(sectionScreenshot.opacityProperty(), 1, interpolator),
            new KeyValue(sectionScreenshot.translateXProperty(), 0, interpolator)));
    keyFrames.add(new KeyFrame(Duration.millis(DURATION),
            event -> {
                sectionDescriptionLabel.setText(selectedSection.description);
                sectionScreenshot.setId(selectedSection.imageId);
            },
            new KeyValue(sectionScreenshot.opacityProperty(), 0, interpolator),
            new KeyValue(sectionScreenshot.translateXProperty(), endX, interpolator)));

    double startX = imageWidth;

    keyFrames.add(new KeyFrame(Duration.millis(DURATION),
            new KeyValue(sectionScreenshot.opacityProperty(), 0, interpolator),
            new KeyValue(sectionScreenshot.translateXProperty(), startX, interpolator)));
    keyFrames.add(new KeyFrame(Duration.millis(DURATION * 2),
            new KeyValue(sectionScreenshot.opacityProperty(), 1, interpolator),
            new KeyValue(sectionScreenshot.translateXProperty(), 0, interpolator)));
}
 
Example #19
Source File: ChartData.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
public void setValue(final double VALUE) {
    if (animated) {
        oldValue = value;
        value    = VALUE;
        timeline.stop();
        KeyValue kv1 = new KeyValue(currentValue, oldValue, Interpolator.EASE_BOTH);
        KeyValue kv2 = new KeyValue(currentValue, VALUE, Interpolator.EASE_BOTH);
        KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
        KeyFrame kf2 = new KeyFrame(Duration.millis(animationDuration), kv2);
        timeline.getKeyFrames().setAll(kf1, kf2);
        timeline.play();
    } else {
        oldValue = value;
        value    = VALUE;
        fireChartDataEvent(FINISHED_EVENT);
    }
}
 
Example #20
Source File: JFXSpinnerSkin.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
private KeyFrame[] getKeyFrames(double angle, double duration, Paint color) {
    KeyFrame[] frames = new KeyFrame[4];
    frames[0] = new KeyFrame(Duration.seconds(duration),
        new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR),
        new KeyValue(arc.startAngleProperty(),
            angle + 45 + control.getStartingAngle(),
            Interpolator.LINEAR));
    frames[1] = new KeyFrame(Duration.seconds(duration + 0.4),
        new KeyValue(arc.lengthProperty(), 250, Interpolator.LINEAR),
        new KeyValue(arc.startAngleProperty(),
            angle + 90 + control.getStartingAngle(),
            Interpolator.LINEAR));
    frames[2] = new KeyFrame(Duration.seconds(duration + 0.7),
        new KeyValue(arc.lengthProperty(), 250, Interpolator.LINEAR),
        new KeyValue(arc.startAngleProperty(),
            angle + 135 + control.getStartingAngle(),
            Interpolator.LINEAR));
    frames[3] = new KeyFrame(Duration.seconds(duration + 1.1),
        new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR),
        new KeyValue(arc.startAngleProperty(),
            angle + 435 + control.getStartingAngle(),
            Interpolator.LINEAR),
        new KeyValue(arc.strokeProperty(), color, Interpolator.EASE_BOTH));
    return frames;
}
 
Example #21
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 #22
Source File: RadialMenu.java    From Enzo with Apache License 2.0 6 votes vote down vote up
public void close() {
    if (State.CLOSED == getState()) return;

    setState(State.CLOSED);
    RotateTransition rotate = new RotateTransition();
    rotate.setNode(cross);
    rotate.setToAngle(0);
    rotate.setDuration(Duration.millis(200));
    rotate.setInterpolator(Interpolator.EASE_BOTH);
    rotate.play();
    closeTimeLines[closeTimeLines.length - 1].setOnFinished(actionEvent -> {
        FadeTransition buttonFadeOut = new FadeTransition();
        buttonFadeOut.setNode(mainMenuButton);
        buttonFadeOut.setDuration(Duration.millis(100));
        buttonFadeOut.setToValue(options.getButtonAlpha());
        buttonFadeOut.play();
        buttonFadeOut.setOnFinished(event -> {
            if (options.isButtonHideOnClose()) hide();
            fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_FINISHED));
        });
    });
    for (int i = 0 ; i < closeTimeLines.length ; i++) {
        closeTimeLines[i].play();
    }
    fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_STARTED));
}
 
Example #23
Source File: JFXCheckBoxSkin.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
CheckBoxTransition(Node mark) {
    super(null, new Timeline(
            new KeyFrame(
                Duration.ZERO,
                new KeyValue(mark.opacityProperty(), 0, Interpolator.EASE_OUT),
                new KeyValue(mark.scaleXProperty(), 0.5, Interpolator.EASE_OUT),
                new KeyValue(mark.scaleYProperty(), 0.5, Interpolator.EASE_OUT)
            ),
            new KeyFrame(Duration.millis(400),
                new KeyValue(mark.opacityProperty(), 1, Interpolator.EASE_OUT),
                new KeyValue(mark.scaleXProperty(), 0.5, Interpolator.EASE_OUT),
                new KeyValue(mark.scaleYProperty(), 0.5, Interpolator.EASE_OUT)
            ),
            new KeyFrame(
                Duration.millis(1000),
                new KeyValue(mark.scaleXProperty(), 1, Interpolator.EASE_OUT),
                new KeyValue(mark.scaleYProperty(), 1, Interpolator.EASE_OUT)
            )
        )
    );
    // reduce the number to increase the shifting , increase number to reduce shifting
    setCycleDuration(Duration.seconds(0.12));
    setDelay(Duration.seconds(0.05));
    this.mark = mark;
}
 
Example #24
Source File: ValidationFacade.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #25
Source File: CenterTransition.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
public CenterTransition(Node contentContainer, Node overlay) {
    super(contentContainer, new Timeline(
        new KeyFrame(Duration.ZERO,
            new KeyValue(contentContainer.scaleXProperty(), 0, Interpolator.LINEAR),
            new KeyValue(contentContainer.scaleYProperty(), 0, Interpolator.LINEAR),
            new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
        ),
        new KeyFrame(Duration.millis(1000),
            new KeyValue(contentContainer.scaleXProperty(), 1, Interpolator.EASE_OUT),
            new KeyValue(contentContainer.scaleYProperty(), 1, Interpolator.EASE_OUT),
            new KeyValue(overlay.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 #26
Source File: HorizontalTransition.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
public HorizontalTransition(boolean leftDirection, Node contentContainer, Node overlay) {
    super(contentContainer, new Timeline(
        new KeyFrame(Duration.ZERO,
            new KeyValue(contentContainer.translateXProperty(),
                (contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX())
                * (leftDirection? -1 : 1), Interpolator.LINEAR),
            new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
        ),
        new KeyFrame(Duration.millis(1000),
            new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
            new KeyValue(contentContainer.translateXProperty(), 0, Interpolator.EASE_OUT)
        )));
    // reduce the number to increase the shifting , increase number to reduce shifting
    setCycleDuration(Duration.seconds(0.4));
    setDelay(Duration.seconds(0));
}
 
Example #27
Source File: VerticalTransition.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) {
    super(contentContainer, new Timeline(
        new KeyFrame(Duration.ZERO,
            new KeyValue(contentContainer.translateYProperty(),
                (contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY())
                * (topDirection? -1 : 1), Interpolator.LINEAR),
            new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
        ),
        new KeyFrame(Duration.millis(1000),
            new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
            new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT)
        )));
    // reduce the number to increase the shifting , increase number to reduce shifting
    setCycleDuration(Duration.seconds(0.4));
    setDelay(Duration.seconds(0));
}
 
Example #28
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 #29
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 #30
Source File: JFXDialog.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
BottomTransition() {
    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));
}