当前位置: 首页>>代码示例>>Java>>正文


Java TranslateTransition.setInterpolator方法代码示例

本文整理汇总了Java中javafx.animation.TranslateTransition.setInterpolator方法的典型用法代码示例。如果您正苦于以下问题:Java TranslateTransition.setInterpolator方法的具体用法?Java TranslateTransition.setInterpolator怎么用?Java TranslateTransition.setInterpolator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.animation.TranslateTransition的用法示例。


在下文中一共展示了TranslateTransition.setInterpolator方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializePromptMoveTransition

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void initializePromptMoveTransition() {
    ScaleTransition promptScale = new ScaleTransition(promptAnimationDuration, this.promptLabel);
    promptScale.setFromX(1);
    promptScale.setFromY(1);
    promptScale.setToX(.7);
    promptScale.setToY(.7);
    promptScale.setInterpolator(promptAnimationInterpolator);

    TranslateTransition promptTranslate = new TranslateTransition(promptAnimationDuration, this.promptLabel);
    promptTranslate.setFromY(0);
    promptTranslate.setToY(-AnchorPane.getTopAnchor(this.promptLabel) - 4);
    promptTranslate.setInterpolator(promptAnimationInterpolator);

    this.promptLabel.translateXProperty().bind(
            this.promptLabel.widthProperty()
            .multiply(this.promptLabel.scaleXProperty()
                    .subtract(1)
                    .divide(2)));

    this.promptMoveAnimation = new ParallelTransition(promptScale, promptTranslate);

    this.promptUp = false;
}
 
开发者ID:Novanoid,项目名称:Tourney,代码行数:24,代码来源:MaterialTextField.java

示例2: panelShake

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/**
 * Shake a panel in the event of an error.
 *
 * @param pane the pane to shake
 */
public static void panelShake(Pane pane) {
    int duration = 100;
    int count = 2;

    TranslateTransition transition1 = new TranslateTransition(Duration.millis(duration), pane);
    transition1.setFromX(0);
    transition1.setToX(-5);
    transition1.setInterpolator(Interpolator.LINEAR);

    TranslateTransition transition2 = new TranslateTransition(Duration.millis(duration), pane);
    transition2.setFromX(-5);
    transition2.setToX(5);
    transition2.setDelay(Duration.millis(duration));
    transition2.setInterpolator(Interpolator.LINEAR);
    transition2.setCycleCount(count);

    TranslateTransition transition3 = new TranslateTransition(Duration.millis(duration), pane);
    transition3.setToX(0);
    transition3.setDelay(Duration.millis((count + 1) * duration));
    transition3.setInterpolator(Interpolator.LINEAR);

    transition1.play();
    transition2.play();
    transition3.play();
}
 
开发者ID:JamesFitzpatrick-Coursework,项目名称:Client-UI,代码行数:31,代码来源:EffectsUtils.java

示例3: swipe2Right

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void swipe2Right(Region to, Region old) {
        to.setTranslateX(0);
        to.setTranslateY(0);

        TranslateTransition translateTransition = new TranslateTransition(Duration.millis(400), old);

        translateTransition.setFromX(old.getLayoutX());
        translateTransition.setToX(master.getLayoutBounds().getWidth());
        translateTransition.setInterpolator(Interpolator.EASE_OUT);
        translateTransition.setCycleCount(1);
        translateTransition.play();

        translateTransition.setOnFinished(new EventHandler() {
            @Override
            public void handle(Event event) {
                System.out.println("master p" + master.getParent());
                master.getChildren().clear();
                master.getChildren().add(to);
                to.prefWidthProperty().bind(master.prefWidthProperty());
//                LayoutUtils.fix2Parent(to, master);
//                to.prefWidthProperty().bind(master.prefWidthProperty());

            }

        });
    }
 
开发者ID:cosysoft,项目名称:agile,代码行数:27,代码来源:MainView.java

示例4: readyToGoAnimation

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public void readyToGoAnimation() {
    // Buttons slide in and clickable address appears simultaneously.
    TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox);
    arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2));
    arrive.setToY(0.0);
    FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl);
    reveal.setToValue(1.0);
    ParallelTransition group = new ParallelTransition(arrive, reveal);
    group.setDelay(NotificationBarPane.ANIM_OUT_DURATION);
    group.setCycleCount(1);
    group.play();
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:13,代码来源:MainController.java

示例5: animateSelection

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/** Animates the surrounding frame to move between two difficulty selections */
private void animateSelection(Node target, Node frame, Stage stage ){
    TranslateTransition animation = new TranslateTransition( Duration.millis(400), frame );
    animation.setInterpolator( Interpolator.EASE_IN );
    //centers the difficulties with and without 'y' in them within the frame properly
    if( target.localToScene( target.getBoundsInLocal(), false ).getMaxY() < stage.getHeight() * 0.4 ){
        animation.setByY( target.localToScene( target.getBoundsInLocal(), false ).getMaxY() -
                frame.localToScene( frame.getBoundsInLocal(), false ).getMaxY() + stage.getHeight() / 100 );
    }else{
        animation.setByY( target.localToScene( target.getBoundsInLocal(), false ).getMaxY() -
                frame.localToScene( frame.getBoundsInLocal(), false ).getMaxY() + stage.getHeight() / 150 );
    }
    animation.play();
}
 
开发者ID:scourgemancer,项目名称:Sudoku_Program_with_Solver,代码行数:15,代码来源:DifficultySelectionState.java

示例6: resetTilePosition

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/**
 * Reset position of tile with smooth transition
 */
public void resetTilePosition() {
    TranslateTransition transition = new TranslateTransition(Duration.millis(300), tile);
    transition.setInterpolator(Interpolator.EASE_OUT);
    transition.setFromX(tile.getTranslateX());
    transition.setToX(0);
    transition.playFromStart();
}
 
开发者ID:gluonhq,项目名称:gluon-samples,代码行数:11,代码来源:SlidingListTile.java

示例7: initialize

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@FXML
public void initialize() {
	
	TranslateTransition translateTransition =
            new TranslateTransition(Duration.millis(10000), background1);
	translateTransition.setFromX(0);
	translateTransition.setToX(-1 * BACKGROUND_WIDTH);
	translateTransition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition translateTransition2 =
           new TranslateTransition(Duration.millis(10000), background2);
	translateTransition2.setFromX(0);
	translateTransition2.setToX(-1 * BACKGROUND_WIDTH);
	translateTransition2.setInterpolator(Interpolator.LINEAR);

	parallelTransition = 
		new ParallelTransition( translateTransition, translateTransition2 );
	parallelTransition.setCycleCount(Animation.INDEFINITE);

	//
	// Sets the label of the Button based on the animation state
	//
	parallelTransition.statusProperty().addListener((obs, oldValue, newValue) -> {
		if( newValue == Animation.Status.RUNNING ) {
			btnControl.setText( "||" );
		} else {
			btnControl.setText( ">" );
		}
	});
}
 
开发者ID:bekwam,项目名称:examples-javafx-repos1,代码行数:31,代码来源:BackgroundController.java

示例8: setPagePosition

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public void setPagePosition(int position) {
    if (animationFinished && (position - currentPosition) != 0) {
        animationFinished = false;
        TranslateTransition transition = new TranslateTransition();
        transition.setByX(((TabTitle) (hBox.getChildren().get(0))).getWidth() * (position - currentPosition));
        transition.setDuration(Duration.millis(150 * Math.abs(position - currentPosition)));
        transition.setInterpolator(Interpolator.LINEAR);
        transition.setNode(line);
        transition.setOnFinished(e -> {
            currentPosition = position;
            animationFinished = true;
        });
        transition.play();
    }
}
 
开发者ID:Tareq-SiSalem,项目名称:JFXMaterial,代码行数:16,代码来源:ActionBar.java

示例9: showOrHide

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/**
 * Shows or hides the pane with an animation.
 *
 * @param stackPane The StackPane, which is shown or hidden.
 * @param show      True, when shown, false when hidden.
 */
private void showOrHide(final AnimatedStackPane stackPane, final boolean show) {
    stackPane.setVisible(true);

    ongoingTransitions++;
    TranslateTransition translateTransition = new TranslateTransition(Duration.seconds(.5), stackPane);
    FadeTransition fadeTransition = new FadeTransition(Duration.seconds(.5), stackPane);
    stackPane.setCache(true);
    stackPane.setCacheHint(CacheHint.SPEED);
    contentPane.setClip(new Rectangle(stackPane.getBoundsInLocal().getWidth(), stackPane.getBoundsInLocal().getHeight()));

    if (show) {
        translateTransition.setFromY(-stackPane.getBoundsInLocal().getHeight());
        translateTransition.setToY(0);
        fadeTransition.setToValue(1);
        fadeTransition.setFromValue(0);
        translateTransition.setInterpolator(new CircularInterpolator(EasingMode.EASE_OUT));
        fadeTransition.setInterpolator(new CircularInterpolator(EasingMode.EASE_OUT));

    } else {
        translateTransition.setToY(-stackPane.getBoundsInLocal().getHeight());
        translateTransition.setFromY(0);
        fadeTransition.setToValue(0);
        fadeTransition.setFromValue(1);
        translateTransition.setInterpolator(new CircularInterpolator(EasingMode.EASE_OUT));
        fadeTransition.setInterpolator(new CircularInterpolator(EasingMode.EASE_OUT));
    }

    ParallelTransition parallelTransition = new ParallelTransition();
    parallelTransition.getChildren().add(translateTransition);
    parallelTransition.getChildren().add(fadeTransition);

    parallelTransition.playFromStart();
    parallelTransition.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {

            if (!show) {
                titleButton.requestFocus();
                stackPane.setVisible(false);
            }
            stackPane.setCache(false);
            ongoingTransitions--;
        }
    });
}
 
开发者ID:scourgemancer,项目名称:graphing-loan-analyzer,代码行数:52,代码来源:CalendarViewSkin.java

示例10: slide

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/**
 * Slides the panes from left to right or vice versa.
 *
 * @param direction The direction, either 1 (moves to right) or -1 (moves to left).
 * @param oldDate   The old date, which the {@link #firstPane} gets set to.
 */
private void slide(int direction, Date oldDate, Date newDate) {

    // Stop any previous animation.
    slideTransition.stop();

    firstPane.setCache(true);
    secondPane.setCache(true);

    TranslateTransition transition1 = new TranslateTransition(Duration.seconds(SLIDE_ANIMATION_DURATION), firstPane);
    TranslateTransition transition2 = new TranslateTransition(Duration.seconds(SLIDE_ANIMATION_DURATION), secondPane);

    Interpolator interpolator = new QuadraticInterpolator(EasingMode.EASE_OUT);
    transition1.setInterpolator(interpolator);
    transition2.setInterpolator(interpolator);

    // Make the first pane visible.
    firstPane.setVisible(true);

    // Set the old date to the first pane.
    firstPane.setDate(oldDate);

     secondPane.setDate(newDate);

    // Set the clip, so that the translate transition stays within the clip.
    //setClip(new Rectangle(getLayoutBounds().getWidth(), getLayoutBounds().getHeight()));

    // Move the first pane away from 0. (I added 1px, so that both panes overlap, which makes it look a little smoother).
    transition1.setFromX(-direction);
    // and either to right or to left.
    transition1.setToX(getLayoutBounds().getWidth() * direction - direction);

    // Move the second pane from left or right
    transition2.setFromX(-getLayoutBounds().getWidth() * direction - direction);

    // Move the second pane to 0
    transition2.setToX(direction);

    slideTransition.getChildren().addAll(transition1, transition2);

    slideTransition.playFromStart();
    slideTransition.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            // When we are finished, set the first pane to invisible and remove the clip.
            firstPane.setVisible(false);
            firstPane.setCache(false);
            secondPane.setCache(false);
        }
    });
}
 
开发者ID:scourgemancer,项目名称:graphing-loan-analyzer,代码行数:57,代码来源:CalendarViewSkin.java

示例11: initialize

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@FXML
public void initialize() {
    
    alert.setGraphic(IconBuilder.create(FontAwesome.FA_VOLUME_UP, 72.0).fill(Color.WHITE).shine(Color.RED).build());
    
    if (appexitbutton) {
        exitbutton.setVisible(true);
        exitbutton.setGraphic(IconBuilder.create(FontAwesome.FA_POWER_OFF, 18.0).styleClass("icon-fill").build());
        exitbutton.setOnAction(ev -> {
            rootpane.getScene().getWindow().hide();
        });
    } else {
        exitbutton.setVisible(false);
        headerbox.getChildren().remove(exitbutton);
        exitbutton = null;
    }
    menubutton.setGraphic(IconBuilder.create(FontAwesome.FA_NAVICON, 18.0).styleClass("icon-fill").build());
    menubutton.setDisable(true);
    
    if (appclock) {
        clock = new Clock(currenttime, resources.getString("clock.pattern"));
        clock.play();
    }
    
    listpagesgray.setBackground(new Background(new BackgroundFill(Color.gray(0.5, 0.75), CornerRadii.EMPTY, Insets.EMPTY)));
    FadeTransition ft = new FadeTransition(Duration.millis(300), scrollpages);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.setInterpolator(Interpolator.LINEAR);
    FadeTransition ft2 = new FadeTransition(Duration.millis(300), listpagesgray);
    ft2.setFromValue(0.0);
    ft2.setToValue(1.0);
    ft2.setInterpolator(Interpolator.LINEAR);
    TranslateTransition tt = new TranslateTransition(Duration.millis(300), scrollpages);
    tt.setFromX(-scrollpages.prefWidth(0));
    tt.setToX(0.0);
    tt.setInterpolator(Interpolator.EASE_BOTH);
    TranslateTransition tt2 = new TranslateTransition(Duration.millis(300), appcontainer);
    tt2.setFromX(0.0);
    tt2.setToX(scrollpages.prefWidth(0));
    tt2.setInterpolator(Interpolator.EASE_BOTH);
    
    listpagestransition = new ParallelTransition(ft, ft2, tt, tt2);
    listpagestransition.setRate(-1.0);
    listpagestransition.setOnFinished((ActionEvent actionEvent) -> {
        if (listpagestransition.getCurrentTime().equals(Duration.ZERO)) {
            scrollpages.setVisible(false);
            listpagesgray.setVisible(false);
        }
    });
}
 
开发者ID:adrianromero,项目名称:helloiot,代码行数:52,代码来源:MQTTMainNode.java

示例12: initialize

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@FXML
public void initialize() {
	
	TranslateTransition background1Transition =
            new TranslateTransition(Duration.millis(8000), background1);
	background1Transition.setFromX(0);
	background1Transition.setToX(-1 * BACKGROUND_WIDTH);
	background1Transition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition background2Transition =
           new TranslateTransition(Duration.millis(8000), background2);
	background2Transition.setFromX(0);
	background2Transition.setToX(-1 * BACKGROUND_WIDTH);
	background2Transition.setInterpolator(Interpolator.LINEAR);

	ParallelTransition backgroundWrapper = new ParallelTransition(
			background1Transition, background2Transition
			);
	backgroundWrapper.setCycleCount(Animation.INDEFINITE);
	
	TranslateTransition clouds1Transition =
            new TranslateTransition(Duration.millis(20000), clouds1);
	clouds1Transition.setFromX(0);
	clouds1Transition.setToX(-1 * BACKGROUND_WIDTH);
	clouds1Transition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition clouds2Transition =
           new TranslateTransition(Duration.millis(20000), clouds2);
	clouds2Transition.setFromX(0);
	clouds2Transition.setToX(-1 * BACKGROUND_WIDTH);
	clouds2Transition.setInterpolator(Interpolator.LINEAR);

	ParallelTransition cloudsWrapper = new ParallelTransition(
			clouds1Transition, clouds2Transition
			);
	cloudsWrapper.setCycleCount(Animation.INDEFINITE);
	
	parallelTransition = 
		new ParallelTransition( backgroundWrapper,
								cloudsWrapper );

	parallelTransition.setCycleCount(Animation.INDEFINITE);

	//
	// Sets the label of the Button based on the animation state
	//
	parallelTransition.statusProperty().addListener((obs, oldValue, newValue) -> {
		if( newValue == Animation.Status.RUNNING ) {
			btnControl.setText( "||" );
		} else {
			btnControl.setText( ">" );
		}
	});
}
 
开发者ID:bekwam,项目名称:examples-javafx-repos1,代码行数:55,代码来源:ImprovedBackgroundController.java

示例13: validateInput

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public void validateInput() {
    ValidationResult validation = this.getInputValidationCallback().call(this.getText());
    if (this.previousResult != null && this.previousResult.equals(validation)) {
        return;
    }
    this.previousResult = validation;
    this.hintLabel.setText(validation.getMessage());
    this.hintIcon.getStyleClass().clear();
    this.hintIcon.getStyleClass().addAll("icon-pane", "message-icon");
    if (validation.getIconStyleClasses().length > 0) {
        this.hintIcon.getStyleClass().addAll(validation.getIconStyleClasses());
    }
    this.hintIcon.setOpacity(validation.getIconStyleClasses().length > 0 ? 1 : 0);
    this.hintIcon.setStyle(String.format("-fx-background-color: #%02x%02x%02x%02x;",
            (int)(validation.getMessageColor().getRed() * 255),
            (int)(validation.getMessageColor().getGreen() * 255),
            (int)(validation.getMessageColor().getBlue() * 255),
            (int)(validation.getMessageColor().getOpacity() * 255)));

    this.hintLabel.setTextFill(validation.messageColor);

    // fade the secondary hint container in and slide it in from the top
    FadeTransition secondaryFadeIn = new FadeTransition(
            hintAnimationDuration, this.hintContainer);
    secondaryFadeIn.setFromValue(0);
    secondaryFadeIn.setToValue(1);
    secondaryFadeIn.setInterpolator(hintAnimationInterpolator);
    TranslateTransition secondaryTranslate = new TranslateTransition(
            hintAnimationDuration, this.hintContainer);
    secondaryTranslate.setFromY(-this.hintContainer.getHeight());
    secondaryTranslate.setToY(0);
    secondaryTranslate.setInterpolator(hintAnimationInterpolator);

    // create a smooth transition for the color of the active underline
    ObjectProperty<Color> highlightColor = new SimpleObjectProperty<>();
    highlightColor.addListener((ov, o, n) -> {
        this.activeUnderline.setStyle(String.format(
                "-fx-background-color: #%02x%02x%02x%02x;",
                (int)(n.getRed() * 255),
                (int)(n.getGreen() * 255),
                (int)(n.getBlue() * 255),
                (int)(n.getOpacity() * 255)));
    });
    if (this.previousBackgroundColor == null) {
        this.previousBackgroundColor = validation.getUnderlineColor();
    }
    Timeline highlightTransition = new Timeline(
            new KeyFrame(Duration.ZERO, new KeyValue(highlightColor,
                    this.previousBackgroundColor)),
            new KeyFrame(hintAnimationDuration, new KeyValue(highlightColor,
                    validation.getUnderlineColor(),
                    hintAnimationInterpolator)));
    this.previousBackgroundColor = validation.getUnderlineColor();

    if (this.hintAnimation != null) {
        this.hintAnimation.stop();
    }

    this.hintAnimation = new ParallelTransition(
            secondaryFadeIn,
            secondaryTranslate,
            highlightTransition);

    this.hintAnimation.play();
}
 
开发者ID:Novanoid,项目名称:Tourney,代码行数:66,代码来源:MaterialTextField.java

示例14: showOrHide

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void showOrHide(
    CalendarControl<T> control,
    Button titleButton,
    SlidingStackPane stackPane,
    boolean show
) {

    Duration duration = control.lengthOfAnimationsProperty().get();

    if (duration.lessThanOrEqualTo(Duration.ZERO)) {
        if (!show) {
            titleButton.requestFocus();
        }
        stackPane.updateVisibility(show);
        return;
    }

    stackPane.updateVisibility(true);
    control.ongoingTransitionsProperty().set(control.ongoingTransitionsProperty().get() + 1);

    TranslateTransition translateTransition = new TranslateTransition(duration, stackPane);
    FadeTransition fadeTransition = new FadeTransition(duration, stackPane);
    translateTransition.setInterpolator(Interpolator.EASE_OUT);
    fadeTransition.setInterpolator(Interpolator.EASE_OUT);

    stackPane.setCache(true);
    stackPane.setCacheHint(CacheHint.SPEED);

    if (show) {
        translateTransition.setFromY(-stackPane.getBoundsInLocal().getHeight());
        translateTransition.setToY(0);
        fadeTransition.setToValue(1);
        fadeTransition.setFromValue(0);
    } else {
        translateTransition.setToY(-stackPane.getBoundsInLocal().getHeight());
        translateTransition.setFromY(0);
        fadeTransition.setToValue(0);
        fadeTransition.setFromValue(1);
    }

    this.setClip(new Rectangle(stackPane.getBoundsInLocal().getWidth(), stackPane.getBoundsInLocal().getHeight()));

    ParallelTransition parallelTransition = new ParallelTransition();
    parallelTransition.getChildren().add(translateTransition);
    parallelTransition.getChildren().add(fadeTransition);
    parallelTransition.playFromStart();

    parallelTransition.setOnFinished(
        actionEvent -> {
            if (!show) {
                titleButton.requestFocus();
                stackPane.updateVisibility(false);
            }
            stackPane.setCache(false);
            control.ongoingTransitionsProperty().set(control.ongoingTransitionsProperty().get() - 1);
        }
    );

}
 
开发者ID:MenoData,项目名称:Time4J,代码行数:60,代码来源:CalendarView.java


注:本文中的javafx.animation.TranslateTransition.setInterpolator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。