當前位置: 首頁>>代碼示例>>Java>>正文


Java ScaleTransition.setInterpolator方法代碼示例

本文整理匯總了Java中javafx.animation.ScaleTransition.setInterpolator方法的典型用法代碼示例。如果您正苦於以下問題:Java ScaleTransition.setInterpolator方法的具體用法?Java ScaleTransition.setInterpolator怎麽用?Java ScaleTransition.setInterpolator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.animation.ScaleTransition的用法示例。


在下文中一共展示了ScaleTransition.setInterpolator方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: animate

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private void animate(Circle particle, Path path) {
    Random randGen = new Random();

    PathTransition pathTransition = new PathTransition(Duration.seconds(path.getElements().size() * (randGen.nextInt(30) + 30)), path, particle);
    pathTransition.setInterpolator(Interpolator.EASE_OUT);

    ScaleTransition scaleTransition = new ScaleTransition(Duration.seconds(3f), particle);
    scaleTransition.setToX(10f);
    scaleTransition.setToY(10f);
    scaleTransition.setInterpolator(Interpolator.EASE_OUT);

    FadeTransition fadeTransition = new FadeTransition(Duration.seconds(6f), particle);
    fadeTransition.setToValue(0.7);
    fadeTransition.setInterpolator(Interpolator.EASE_OUT);

    pathTransition.play();
    scaleTransition.play();
    fadeTransition.play();
}
 
開發者ID:Cldfire,項目名稱:Forum-Notifier,代碼行數:20,代碼來源:ParticleAnimation.java

示例2: initializePromptMoveTransition

import javafx.animation.ScaleTransition; //導入方法依賴的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

示例3: animateNewlyAddedTile

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
 * Animation that creates a fade in effect when a tile is added to the game 
 * by increasing the tile scale from 0 to 100% 
 * @param tile to be animated
 * @return a scale transition 
 */
private ScaleTransition animateNewlyAddedTile(Tile tile) {
    final ScaleTransition scaleTransition = new ScaleTransition(ANIMATION_NEWLY_ADDED_TILE, tile);
    scaleTransition.setToX(1.0);
    scaleTransition.setToY(1.0);
    scaleTransition.setInterpolator(Interpolator.EASE_OUT);
    scaleTransition.setOnFinished(e -> {
        // after last movement on full grid, check if there are movements available
        if (this.gameGrid.values().parallelStream().noneMatch(Objects::isNull) && mergeMovementsAvailable() == 0 ) {
            board.setGameOver(true);
        }
    });
    return scaleTransition;
}
 
開發者ID:juebanlin,項目名稱:util4j,代碼行數:20,代碼來源:GameManager.java

示例4: animateMergedTile

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
 * Animation that creates a pop effect when two tiles merge
 * by increasing the tile scale to 120% at the middle, and then going back to 100% 
 * @param tile to be animated
 * @return a sequential transition 
 */
private SequentialTransition animateMergedTile(Tile tile) {
    final ScaleTransition scale0 = new ScaleTransition(ANIMATION_MERGED_TILE, tile);
    scale0.setToX(1.2);
    scale0.setToY(1.2);
    scale0.setInterpolator(Interpolator.EASE_IN);

    final ScaleTransition scale1 = new ScaleTransition(ANIMATION_MERGED_TILE, tile);
    scale1.setToX(1.0);
    scale1.setToY(1.0);
    scale1.setInterpolator(Interpolator.EASE_OUT);

    return new SequentialTransition(scale0, scale1);
}
 
開發者ID:juebanlin,項目名稱:util4j,代碼行數:20,代碼來源:GameManager.java

示例5: AnimatedPopup

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private AnimatedPopup() {

            showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
            showFadeTransition.setFromValue(0);
            showFadeTransition.setToValue(1);
            showFadeTransition.setInterpolator(new BackInterpolator());

            showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
            showScaleTransition.setFromX(0.8);
            showScaleTransition.setFromY(0.8);
            showScaleTransition.setToY(1);
            showScaleTransition.setToX(1);

            showScaleTransition.setInterpolator(new BackInterpolator());

            hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
            hideFadeTransition.setFromValue(1);
            hideFadeTransition.setToValue(0);
            hideFadeTransition.setInterpolator(new BackInterpolator());

            hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
            hideScaleTransition.setFromX(1);
            hideScaleTransition.setFromY(1);
            hideScaleTransition.setToY(0.8);
            hideScaleTransition.setToX(0.8);

            hideScaleTransition.setInterpolator(new BackInterpolator());
            hideScaleTransition.setOnFinished(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    if (AnimatedPopup.super.isShowing()) {
                        AnimatedPopup.super.hide();
                    }
                }
            });
        }
 
開發者ID:scourgemancer,項目名稱:graphing-loan-analyzer,代碼行數:37,代碼來源:DatePickerSkin.java

示例6: initializeUnderlineAnimation

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private void initializeUnderlineAnimation() {
    ScaleTransition scaleX = new ScaleTransition(underlineAnimationDuration, this.activeUnderline);
    scaleX.setFromX(0);
    scaleX.setToX(1);
    scaleX.setInterpolator(underlineAnimationInterpolator);
    FadeTransition fade = new FadeTransition(underlineAnimationDuration, this.activeUnderline);
    fade.setFromValue(0);
    fade.setToValue(1);
    this.underlineAnimation = new ParallelTransition(scaleX, fade);
}
 
開發者ID:Novanoid,項目名稱:Tourney,代碼行數:11,代碼來源:MaterialTextField.java

示例7: animateNewlyAddedTile

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
 * Animation that creates a fade in effect when a tile is added to the game 
 * by increasing the tile scale from 0 to 100% 
 * @param tile to be animated
 * @return a scale transition 
 */
private ScaleTransition animateNewlyAddedTile(Tile tile) {
    final ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(125), tile);
    scaleTransition.setToX(1.0);
    scaleTransition.setToY(1.0);
    scaleTransition.setInterpolator(Interpolator.EASE_OUT);
    scaleTransition.setOnFinished(e -> {
        // after last movement on full grid, check if there are movements available
        if (checkEndGame()) {
            board.setGameOver(true);
        }
    });
    return scaleTransition;
}
 
開發者ID:jperedadnr,項目名稱:Game2048FX,代碼行數:20,代碼來源:GameManager.java

示例8: animateMergedTile

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
 * Animation that creates a pop effect when two tiles merge
 * by increasing the tile scale to 120% at the middle, and then going back to 100% 
 * @param tile to be animated
 * @return a sequential transition 
 */
private SequentialTransition animateMergedTile(Tile tile) {
    final ScaleTransition scale0 = new ScaleTransition(Duration.millis(80), tile);
    scale0.setToX(1.2);
    scale0.setToY(1.2);
    scale0.setInterpolator(Interpolator.EASE_IN);

    final ScaleTransition scale1 = new ScaleTransition(Duration.millis(80), tile);
    scale1.setToX(1.0);
    scale1.setToY(1.0);
    scale1.setInterpolator(Interpolator.EASE_OUT);

    return new SequentialTransition(scale0, scale1);
}
 
開發者ID:jperedadnr,項目名稱:Game2048FX,代碼行數:20,代碼來源:GameManager.java

示例9: startButtonPressed

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
@FXML
private void startButtonPressed(ActionEvent event) 
{
   // transition that changes a shape's fill   
   FillTransition fillTransition = 
      new FillTransition(Duration.seconds(1));
   fillTransition.setToValue(Color.CYAN);
   fillTransition.setCycleCount(2);
   
   // each even cycle plays transition in reverse to restore original
   fillTransition.setAutoReverse(true); 

   // transition that changes a shape's stroke over time  
   StrokeTransition strokeTransition = 
      new StrokeTransition(Duration.seconds(1));
   strokeTransition.setToValue(Color.BLUE);
   strokeTransition.setCycleCount(2);
   strokeTransition.setAutoReverse(true);
   
   // parallelizes multiple transitions  
   ParallelTransition parallelTransition = 
      new ParallelTransition(fillTransition, strokeTransition);

   // transition that changes a node's opacity over time
   FadeTransition fadeTransition = 
      new FadeTransition(Duration.seconds(1));
   fadeTransition.setFromValue(1.0); // opaque
   fadeTransition.setToValue(0.0); // transparent
   fadeTransition.setCycleCount(2);
   fadeTransition.setAutoReverse(true);

   // transition that rotates a node 
   RotateTransition rotateTransition = 
      new RotateTransition(Duration.seconds(1));
   rotateTransition.setByAngle(360.0);
   rotateTransition.setCycleCount(2);
   rotateTransition.setInterpolator(Interpolator.EASE_BOTH);
   rotateTransition.setAutoReverse(true);
   
   // transition that moves a node along a Path  
   Path path = new Path(new MoveTo(45, 45), new LineTo(45, 0), 
      new LineTo(90, 0), new LineTo(90, 90), new LineTo(0, 90));
   PathTransition translateTransition = 
      new PathTransition(Duration.seconds(2), path);
   translateTransition.setCycleCount(2);
   translateTransition.setInterpolator(Interpolator.EASE_IN);
   translateTransition.setAutoReverse(true);
   
   // transition that scales a shape to make it larger or smaller
   ScaleTransition scaleTransition =
      new ScaleTransition(Duration.seconds(1));
   scaleTransition.setByX(0.75);
   scaleTransition.setByY(0.75);
   scaleTransition.setCycleCount(2);
   scaleTransition.setInterpolator(Interpolator.EASE_OUT);
   scaleTransition.setAutoReverse(true);

   // transition that applies a sequence of transitions to a node
   SequentialTransition sequentialTransition = 
      new SequentialTransition (rectangle, parallelTransition, 
         fadeTransition, rotateTransition, translateTransition, 
         scaleTransition);
   sequentialTransition.play(); // play the transition
}
 
開發者ID:cleitonferreira,項目名稱:LivroJavaComoProgramar10Edicao,代碼行數:65,代碼來源:TransitionAnimationsController.java

示例10: AnimatedPopup

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
AnimatedPopup() {
    super();

    Interpolator interpolator = new PopupInterpolator();

    showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
    showFadeTransition.setFromValue(0);
    showFadeTransition.setToValue(1);
    showFadeTransition.setInterpolator(interpolator);

    showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
    showScaleTransition.setFromX(0.8);
    showScaleTransition.setFromY(0.8);
    showScaleTransition.setToY(1);
    showScaleTransition.setToX(1);
    showScaleTransition.setInterpolator(interpolator);

    hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
    hideFadeTransition.setFromValue(1);
    hideFadeTransition.setToValue(0);
    hideFadeTransition.setInterpolator(interpolator);

    hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
    hideScaleTransition.setFromX(1);
    hideScaleTransition.setFromY(1);
    hideScaleTransition.setToY(0.8);
    hideScaleTransition.setToX(0.8);
    hideScaleTransition.setInterpolator(interpolator);

    hideScaleTransition.setOnFinished(
        actionEvent -> {
            if (AnimatedPopup.super.isShowing()) {
                AnimatedPopup.super.hide();
            }
        }
    );

    this.closingHandler = (
        event -> {
            final Popup p = popupDialog;

            if (p != null) {
                p.getOwnerWindow().removeEventFilter(
                    WindowEvent.WINDOW_CLOSE_REQUEST,
                    getClosingHandler());

                if (p.isShowing()) {
                    // first closing request will only close the popup dialog but not the window
                    p.hide();
                    event.consume();
                }

                popupDialog = null;
            }
        }
    );

}
 
開發者ID:MenoData,項目名稱:Time4J,代碼行數:59,代碼來源:CalendarPicker.java


注:本文中的javafx.animation.ScaleTransition.setInterpolator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。