Java 类javafx.animation.TranslateTransition 实例源码

项目:marathonv5    文件:TranslateTransitionSample.java   
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:marathonv5    文件:TranslateTransitionSample.java   
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:The-Trail    文件:TravelController.java   
@FXML
public void initialize(){

    Main.checkFullScreen();

    Main.getAlertWindow().setOnCloseRequest(e -> spriteImage.setImage(new Image(Gang.getCarSpriteURL())));

    // updating labels
    distanceLabel.setText("To go: "+ Gang.getDistance() +"Mi");
    conditionsLabel.setText("Condition: "+ Gang.getHealthConditions());
    daysLabel.setText("Days: "+ Gang.getDays());
    statusLabel.setText("Status: Resting");

    // setting up how the animation will work
    drivingTransition = new TranslateTransition();
    drivingTransition.setDuration(Duration.seconds(animationDuration));
    drivingTransition.setToX(Main.getMainWindow().getWidth() - 850);
    drivingTransition.setNode(sprite);
    drivingTransition.setCycleCount(Animation.INDEFINITE);

    // fixes the bug with thread not ending when stage was closed
    Main.getMainWindow().setOnCloseRequest(e -> Gang.setMoving(false));
}
项目:The-Trail    文件:TravelController.java   
@FXML
private void updateGUI(){

    spriteImage.setImage(new Image(Gang.getCarSpriteURL()));

    // updating drivingTransition
    drivingTransition = new TranslateTransition();
    drivingTransition.setDuration(Duration.seconds(animationDuration));
    drivingTransition.setToX((Main.getMainWindow().getWidth() / -1) - 400);
    drivingTransition.setNode(sprite);
    drivingTransition.setCycleCount(Animation.INDEFINITE);

    // updating labels
    distanceLabel.setText("To go: "+ Gang.getDistance() +"Mi");
    conditionsLabel.setText("Condition: "+ Gang.getHealthConditions());
    daysLabel.setText("Days: "+ Gang.getDays());
    statusLabel.setText("Status: Resting");
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * Animates a label with the plus(new additional value) text.
 * @param plus 
 */
private void setPlusScoreAnimation(String plus) {
    if(plus.length() > 2 ) {
        double width = 25 * plus.length();
        PLUS_SCORE.setMinSize(width, 45);
    }
    PLUS_SCORE.setText("+" + plus);
    this.setScoreStyle();
    PLUS_SCORE.setTextFill(Color.WHITE);
    FadeTransition ft = new FadeTransition(Duration.seconds(.7), PLUS_SCORE);
    ft.setFromValue(1);
    ft.setToValue(0);
    ft.play();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(.7), PLUS_SCORE);
    tt.setFromX(55);
    tt.setFromY(-50);
    tt.setToY(50);
    tt.play();
}
项目:CardGame    文件:GameOverviewController.java   
public void animation(int cardid){
    TranslateTransition transition = new TranslateTransition();
    transition.setDuration(Duration.millis(150));
    transition.setNode(hash_hhcard.get(cardid));
    transition.setToY(-100);
    transition.setAutoReverse(true);
    transition.setCycleCount(2);

    transition.setOnFinished(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            try {
                playCard(cardid);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    });
    transition.play();

}
项目:KenzieTheBot    文件:MainController.java   
@FXML //Deprecated method.
private void drawerAction() {

    TranslateTransition openNav = new TranslateTransition(
            new Duration(500), drawer);
    openNav.setToX(0);

    TranslateTransition closeNav = new TranslateTransition(
            new Duration(500), drawer);
    menu.setOnAction(
            (ActionEvent evt) -> {

                if (drawer.getTranslateX() != 0) {

                    openNav.play();
                } else {

                    closeNav.setToX(-(drawer.getWidth()));
                    closeNav.play();
                }
            });
}
项目:fx-animation-editor    文件:KeyFrameDragAnimator.java   
public TranslateAnimation(Node child, Node dragged) {
    initialX = child.getLayoutX();
    initialIndex = container.getChildren().indexOf(child);
    if (child != dragged) {
        translate = new TranslateTransition(DURATION, child);

        double displacement = dragged.getLayoutBounds().getWidth() + container.getSpacing();
        if (initialIndex < container.getChildren().indexOf(dragged)) {
            translate.setFromX(0);
            translate.setToX(displacement);
        } else {
            translate.setFromX(-displacement);
            translate.setToX(0);
            translate.jumpTo(DURATION);
            forward.set(true);
        }

        forward.addListener((v, o, n) -> {
            translate.setRate(n ? 1 : -1);
            translate.play();
        });
    } else {
        translate = null;
    }
}
项目:ApkToolPlus    文件:Toast.java   
public Toast show(StackPane ui, long duration){
        Platform.runLater(() -> {
            ui.getChildren().add(label);
            StackPane.setAlignment(label, Pos.BOTTOM_CENTER); // 从下方居中往中间移动
            TranslateTransition tt = new TranslateTransition(Duration.millis(200), label);
            tt.setByY(-(ui.getHeight()/2));
            tt.setCycleCount(1);
            tt.setAutoReverse(false);
            tt.setOnFinished(event -> {
//                LogUtils.d("toast animation finish.");
                Timer timer = new Timer();
                timer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        if(label.getParent() != null){
                            Platform.runLater(() -> ui.getChildren().remove(label));
                            timer.cancel();
                        }
                    }
                },duration);
            });
            tt.play();
        });
        return this;
    }
项目:FXGLGames    文件:GeoWarsApp.java   
private void deductScoreDeath() {
    inc("score", -1000);
    set("kills", 0);
    set("multiplier", 1);

    Text bonusText = getUIFactory().newText("-1000", Color.WHITE, 20);
    bonusText.setTranslateX(1100);
    bonusText.setTranslateY(70);

    getGameScene().addUINode(bonusText);

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.5), bonusText);
    tt.setToY(0);
    tt.setOnFinished(e -> {
        getGameScene().removeUINode(bonusText);
    });
    tt.play();
}
项目:FXGLGames    文件:GameController.java   
private Animation getAnimationLoseLife(Texture texture) {
    texture.setFitWidth(64);
    texture.setFitHeight(64);

    Viewport viewport = gameScene.getViewport();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.66), texture);
    tt.setToX(viewport.getWidth() / 2 - texture.getFitWidth() / 2);
    tt.setToY(viewport.getHeight() / 2 - texture.getFitHeight() / 2);

    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), texture);
    st.setToX(0);
    st.setToY(0);

    return new SequentialTransition(tt, st);
}
项目:Spellmonger3    文件:ControllerPlay.java   
private void TransitionForAll(Rectangle rectangle, double layoutXFrom, double layoutXTo, double layoutYFrom, double layoutYTo) {
    mainPane.getChildren().add(rectangle);
    TranslateTransition translateTransition = new TranslateTransition(Duration.millis(800), rectangle);
    translateTransition.setFromX(layoutXFrom);
    translateTransition.setToX(layoutXTo);
    translateTransition.setFromY(layoutYFrom);
    translateTransition.setToY(layoutYTo);
    translateTransition.setCycleCount(1);
    translateTransition.setAutoReverse(true);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(800), rectangle);
    fadeTransition.setFromValue(1.0f);
    fadeTransition.setToValue(0f);
    fadeTransition.setCycleCount(1);
    fadeTransition.setAutoReverse(true);
    translateTransition.play();
    fadeTransition.play();
    rectangle.setDisable(true);
    Rectangle newRectangle = new Rectangle(10, 10);
    eventExit(rectangle, newRectangle);
}
项目:FakeImageDetection    文件:LaunchScreeenController.java   
private void animate() {
    TranslateTransition tt = new TranslateTransition(Duration.millis(duration), load_image_button);
    TranslateTransition tLogo = new TranslateTransition(Duration.millis(duration), christopher);
    TranslateTransition tDesc = new TranslateTransition(Duration.millis(duration), description);

    ScaleTransition st = new ScaleTransition(Duration.millis(duration), load_image_button);
    st.setToX(3);
    st.setToY(3);

    tt.setByY(-180f);

    tLogo.setToY(50);
    tDesc.setToY(500);
    buttonParallelTransition = new ParallelTransition(load_image_button, st, tt, tLogo, tDesc);

    buttonParallelTransition.play();
    buttonParallelTransition.setOnFinished((e) -> {
        load_image_button.setOpacity(1);
    });
}
项目:enders_game    文件:Puzzle.java   
/**
 * Animates the bullet to follow the path taken
 * @param tileSize
 */
private void animateBullet() {
    int tileSize = tileWidthsList.get(level - 1);
    timeline = new Timeline(new KeyFrame(Duration.millis(Settings.PUZZLE_BULLET_SPEED), e -> {
        if(bulletIndex < pathTaken.size()) {
            TranslateTransition tt = new TranslateTransition(Duration.millis(Settings.PUZZLE_BULLET_SPEED), bulletNode);
            tt.setToX(tileSize/2 + pathTaken.get(bulletIndex)[1]*tileSize);
            tt.setToY(tileSize/2 + pathTaken.get(bulletIndex)[0]*tileSize);
            tt.setCycleCount(1);
            tt.play();
            bulletIndex++;
        }
        handleLevelCompletion();
    }));
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
项目:slogo    文件:TurtleView.java   
@Override
public void update (Object object) {
    ITurtleState state = (ITurtleState) object;

    this.penStyleIndex = state.getPenStyle();
    TranslateTransition tt = new TranslateTransition(Duration.millis(mySpeed), this);

    double currentX = this.getTranslateX(); double currentY = this.getTranslateY();
    tt.setByX(currentX); tt.setByY(currentY); tt.setToX(state.getX()); tt.setToY(state.getY());

    RotateTransition rt = new RotateTransition(Duration.millis(mySpeed), this);

    double currentHeading = this.getRotate();
    rt.setByAngle(currentHeading); rt.setToAngle(state.getHeading());

    ParallelTransition pt = new ParallelTransition();
    pt.getChildren().addAll(tt, rt);

    pt.setOnFinished(e -> {
        updateTurtleState(state);
        System.out.println("myturtle: " + this.toString());
        tooltip.setText(this.toString());
    });

    pt.play();
}
项目:rapidminer-studio    文件:BrowserPopup.java   
public void closeWithReason(String reason) {
    // Store the reason
    reasonQueue.offer(reason);
    if (!closed.compareAndSet(false, true)) {
        return;
    }
    // Slide out & dispose
    Platform.runLater(() -> {
        if (webView != null) {
            ImageView imageView = new ImageView(webView.snapshot(null, null));
            animatedPane.getChildren().set(0, imageView);
            dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
        }
        TranslateTransition slideOut = new TranslateTransition(Duration.millis(TRANSLATION_MS), animatedPane);
        slideOut.setInterpolator(Interpolator.EASE_IN);
        slideOut.setByX(translationDistance);
        slideOut.setOnFinished(e -> dispose());
        slideOut.play();
    });
}
项目:FXGLGames    文件:GeoWarsApp.java   
private void deductScoreDeath() {
    inc("score", -1000);
    set("kills", 0);
    set("multiplier", 1);

    Text bonusText = getUIFactory().newText("-1000", Color.WHITE, 20);
    bonusText.setTranslateX(1100);
    bonusText.setTranslateY(70);

    getGameScene().addUINode(bonusText);

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.5), bonusText);
    tt.setToY(0);
    tt.setOnFinished(e -> {
        getGameScene().removeUINode(bonusText);
    });
    tt.play();
}
项目:FXGLGames    文件:GameController.java   
private Animation getAnimationLoseLife(Texture texture) {
    texture.setFitWidth(64);
    texture.setFitHeight(64);

    Viewport viewport = gameScene.getViewport();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.66), texture);
    tt.setToX(viewport.getWidth() / 2 - texture.getFitWidth() / 2);
    tt.setToY(viewport.getHeight() / 2 - texture.getFitHeight() / 2);

    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), texture);
    st.setToX(0);
    st.setToY(0);

    return new SequentialTransition(tt, st);
}
项目:metastone    文件:HealingNumber.java   
public HealingNumber(String text, GameToken parent) {
    this.parent = parent;

    setText(text);
    setFill(Color.GREEN);
    setStyle("-fx-font-size: 28pt; -fx-font-family: \"System\";-fx-font-weight: bolder;-fx-stroke: black;-fx-stroke-width: 2;");

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

    parent.getAnchor().getChildren().add(this);

    NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
    TranslateTransition animation = new TranslateTransition(Duration.seconds(0.5), this);
    animation.setToY(-30);
    animation.setOnFinished(this::onComplete);
    animation.play();
}
项目:bco.bcozy    文件:LocationPane.java   
private void autoFocusPolygonAnimated(final LocationPolygon polygon) {
    final double xScale = (foregroundPane.getBoundingBox().getWidth() / polygon.prefWidth(0))
            * Constants.ZOOM_FIT_PERCENTAGE_WIDTH;
    final double yScale = (foregroundPane.getBoundingBox().getHeight() / polygon.prefHeight(0))
            * Constants.ZOOM_FIT_PERCENTAGE_HEIGHT;
    final double scale = (xScale < yScale) ? xScale : yScale;

    final ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(500));
    scaleTransition.setToX(scale);
    scaleTransition.setToY(scale);
    scaleTransition.setCycleCount(1);
    scaleTransition.setAutoReverse(true);

    final Point2D transition = calculateTransition(scale, polygon);

    final TranslateTransition translateTransition = new TranslateTransition(Duration.millis(500));
    translateTransition.setToX(transition.getX());
    translateTransition.setToY(transition.getY());
    translateTransition.setCycleCount(1);
    translateTransition.setAutoReverse(true);

    final ParallelTransition parallelTransition
            = new ParallelTransition(this, scaleTransition, translateTransition);
    parallelTransition.play();
}
项目:Tourney    文件:MaterialTextField.java   
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;
}
项目:FXTutorials    文件:GameDevMath.java   
@Override
public void start(Stage primaryStage) throws Exception {
    Scene scene = new Scene(createContent());
    scene.setOnMouseClicked(event -> {
        player.setTranslateX(event.getSceneX());
        player.setTranslateY(event.getSceneY());

        Point2D vector = player.getPoint().subtract(enemy.getPoint());

        vectorView.setVector(vector);

        PointView bullet = new PointView(enemy.getPoint());
        root.getChildren().add(bullet);

        TranslateTransition tt = new TranslateTransition(Duration.seconds(3), bullet);
        tt.setByX(vector.getX());
        tt.setByY(vector.getY());
        tt.setAutoReverse(true);
        tt.setCycleCount(2);
        tt.setOnFinished(e -> root.getChildren().remove(bullet));
        tt.play();
    });

    primaryStage.setScene(scene);
    primaryStage.show();
}
项目:FXTutorials    文件:MKXMenuApp.java   
private Node createMiddleContent() {
    String title = "MKX Menu App";
    HBox letters = new HBox(0);
    letters.setAlignment(Pos.CENTER);
    for (int i = 0; i < title.length(); i++) {
        Text letter = new Text(title.charAt(i) + "");
        letter.setFont(FONT);
        letter.setFill(Color.WHITE);
        letters.getChildren().add(letter);

        TranslateTransition tt = new TranslateTransition(Duration.seconds(2), letter);
        tt.setDelay(Duration.millis(i * 50));
        tt.setToY(-25);
        tt.setAutoReverse(true);
        tt.setCycleCount(TranslateTransition.INDEFINITE);
        tt.play();
    }

    return letters;
}
项目:FXTutorials    文件:MKXMenuApp.java   
private Node createRightContent() {
    String title = "Please Subscribe :)";
    HBox letters = new HBox(0);
    letters.setAlignment(Pos.CENTER);
    for (int i = 0; i < title.length(); i++) {
        Text letter = new Text(title.charAt(i) + "");
        letter.setFont(FONT);
        letter.setFill(Color.WHITE);
        letter.setOpacity(0);
        letters.getChildren().add(letter);

        FadeTransition ft = new FadeTransition(Duration.seconds(2), letter);
        ft.setDelay(Duration.millis(i * 50));
        ft.setToValue(1);
        ft.setAutoReverse(true);
        ft.setCycleCount(TranslateTransition.INDEFINITE);
        ft.play();
    }

    return letters;
}
项目:Machiavelli    文件:SpelregelsView.java   
/**
 * Laat de Spelregels pane zien in de huidige stage. Er wordt een nieuwe StackPane aangemaakt,
 * waarin de nieuwe pane en de huidige pane worden geplaatst. De huidige pane wordt later dan de
 * nieuwe pane (van de SpelregelsView) geplaatst, zodat die onderop ligt. De nieuwe pane krijgt
 * opnieuw de css styling mee. De nieuwe StackPane wordt in de huidige scene geplaatst van de
 * singleton stage.
 */
public void show() {
    holder = new StackPane();
    holder.getChildren().addAll(stage.getScene().getRoot().getChildrenUnmodifiable());
    holder.getChildren().add(stPane);
    holder.getStylesheets().add("Machiavelli/Resources/style.css");

    FadeTransition ft = new FadeTransition(Duration.millis(300), holder);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();

    TranslateTransition tt = new TranslateTransition(Duration.millis(300), modal);
    tt.setFromY(50);
    tt.setToY(0);
    tt.play();

    this.scene = new Scene(holder, 1440, 900);
    stage.setScene(scene);
    stage.show();
}
项目:Client-UI    文件:EffectsUtils.java   
/**
 * 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();
}
项目:mmorpg    文件:UIAnimations.java   
public LevelUpAnimation(Group root, Player player) {
    Platform.runLater(() -> {
        Text text = new Text("Level UP!");
        text.setFill(Color.AQUAMARINE);
        text.setFont(UIConst.FONT);
        root.getChildren().add(text);
        TranslateTransition tt = new TranslateTransition(Duration.seconds(1.5), text);

        tt.setFromX(player.getX() - 30);
        tt.setFromY(player.getY());
        tt.setToX(player.getX() - 30);
        tt.setToY(player.getY() - 80);

        tt.setOnFinished(event -> {
            root.getChildren().remove(text);
        });

        tt.play();
    });
}
项目:mmorpg    文件:UIAnimations.java   
public BasicDamageAnimation(String dmgText, int x, int y) {
    Platform.runLater(() -> {
        Text text = new Text(dmgText);
        text.setFill(Color.CORNSILK);
        text.setFont(text.getFont().font(14));
        root.getChildren().add(text);
        TranslateTransition tt = new TranslateTransition(Duration.seconds(1.5), text);

        tt.setFromX(x);
        tt.setFromY(y);
        tt.setToX(x + GameMath.random(100) - 50);
        tt.setToY(y - GameMath.random(50));

        tt.setOnFinished(event -> {
            root.getChildren().remove(text);
        });

        tt.play();
    });
}
项目:mmorpg    文件:UIAnimations.java   
public SkillDamageAnimation(String dmgText, int x, int y) {
    Platform.runLater(() -> {
        Text text = new Text(dmgText);
        text.setFill(Color.AQUAMARINE);
        text.setFont(text.getFont().font(16));
        root.getChildren().add(text);
        TranslateTransition tt = new TranslateTransition(Duration.seconds(1.5), text);

        tt.setFromX(x);
        tt.setFromY(y);
        tt.setToX(x + GameMath.random(100) - 50);
        tt.setToY(y - GameMath.random(50));

        tt.setOnFinished(event -> {
            root.getChildren().remove(text);
        });

        ScaleTransition st = new ScaleTransition(Duration.seconds(0.75), text);
        st.setFromX(1);
        st.setToX(1.5);

        st.play();
        tt.play();
    });
}
项目:mmorpg    文件:UIAnimations.java   
public MoneyGainAnimation(int money) {
    Platform.runLater(() -> {
        Text text = new Text(money + "G");
        text.setFill(Color.GOLD);
        text.setFont(UIConst.FONT);
        root.getChildren().add(text);
        TranslateTransition tt = new TranslateTransition(Duration.seconds(1.5), text);

        tt.setFromX(player.getX() + 100);
        tt.setFromY(player.getY());
        tt.setToX(player.getX() + 100);
        tt.setToY(player.getY() - 40);

        tt.setOnFinished(event -> {
            root.getChildren().remove(text);
        });

        tt.play();
    });
}
项目:mmorpg    文件:UIAnimations.java   
public XPGainAnimation(double xp) {
    Platform.runLater(() -> {
        Text text = new Text(String.format("%.2f%s", xp*100, "% XP"));
        text.setFill(Color.YELLOWGREEN);
        text.setFont(UIConst.FONT);
        root.getChildren().add(text);
        TranslateTransition tt = new TranslateTransition(Duration.seconds(1.5), text);

        tt.setFromX(player.getX() - 90);
        tt.setFromY(player.getY());
        tt.setToX(player.getX() - 90);
        tt.setToY(player.getY() - 25);

        tt.setOnFinished(event -> {
            root.getChildren().remove(text);
        });

        tt.play();
    });
}
项目:Wallet    文件:PairWallet.java   
private void afterPairingAnimation() {
    Platform.runLater(new Runnable() {
      @Override public void run() {
          TranslateTransition move = new TranslateTransition(Duration.millis(400), imgViewQR);
          move.setByX(-437.0);
          move.setCycleCount(1);
          move.play();
          imgViewQR.setImage(null);
          pairPane.setVisible(true);
          qrPane.setVisible(false);

          runBtn.setDisable(true);
          btnBack.setDisable(true);
          cancelBtn.setText("Done");
      }
});
  }
项目:agile    文件:MainView.java   
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());

            }

        });
    }
项目:kotlinfx-ensemble    文件:TranslateTransitionSample.java   
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:jointry    文件:CostumeStmnt.java   
@Override
public Object eval(Environment env) {
    final Object c = ((ASTree) condition()).eval(env);
    if (c instanceof Integer) {
        final Sprite sprite = env.getSprite();
        SequentialTransition st = env.getSequentialTransition();
        TranslateTransition tt
                = new TranslateTransition(Duration.millis(10), sprite);
        tt.setOnFinished(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {
                sprite.setSpriteCostume((int) c);
            }
        });
        st.getChildren().add(tt);
    }
    return c;
}
项目:jointry    文件:MoveStmnt.java   
@Override
public Object eval(Environment env) {
    Object c = ((ASTree) condition()).eval(env);
    if (c instanceof Integer) {
        Sprite sprite = env.getSprite();
        SequentialTransition st = env.getSequentialTransition();
        System.out.println(env.getSpeed());
        TranslateTransition tt
                = new TranslateTransition(Duration.millis(env.getSpeed()), sprite);
        double x = sprite.moveBy((Integer) c);
        tt.setByX(x);
        env.setX(sprite.getX() + env.getX() + x);
        st.getChildren().add(tt);
    }
    return c;
}
项目:jointry    文件:SpeechStmnt.java   
@Override
public Object eval(Environment env) {
    final Object c = ((ASTree) condition()).eval(env);

    final Sprite sprite = env.getSprite();
    SequentialTransition st = env.getSequentialTransition();
    TranslateTransition tt
                        = new TranslateTransition(Duration.millis(10), sprite);
    tt.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent t) {
            sprite.setSpeechBubble(c.toString());
        }
    });
    st.getChildren().add(tt);

    return c;
}
项目:Starbound-Mod-Manager    文件:ModListView.java   
protected void animate(final ModView modView, final int amount) {

     TranslateTransition tt = new TranslateTransition(Duration.millis(80), modView.getContent());
     tt.setByY(amount);
     tt.setCycleCount(1);
     tt.setAutoReverse(false);
     tt.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            modView.moving = false;
        }
    });

     tt.play();

}
项目:iliasDownloaderTool    文件:LoginFader.java   
private void fade(double c, GridPane login) {
    TranslateTransition t1 = new TranslateTransition(Duration.millis(500), dashboard.getActionBar());
    t1.setByX(c);

    TranslateTransition t2 = new TranslateTransition(Duration.millis(500), login);
    t2.setByX(c);
    t2.setFromX(login.getLayoutX() - c);
    t2.setToX(login.getLayoutX());

    p.getChildren().addAll(t1, t2);
    p.setInterpolator(new Interpolator() {
        @Override
        protected double curve(double t) {
            return Math.pow(t, 2);
        }
    });
    p.play();
    if (login.getOpacity() == 0) {
        login.setOpacity(1);
    } else {
        login.setOpacity(0);
    }
}
项目:FEFEditor    文件:ToggleSwitchSkin.java   
private void selectedStateChanged() {
    TranslateTransition transition = new TranslateTransition(Duration.millis(100), thumb);
    double thumbAreaWidth = snapSize(thumbArea.prefWidth(-1));
    double thumbWidth = snapSize(thumb.prefWidth(-1));

    if (!getSkinnable().isSelected())
        transition.setByX(-(thumbAreaWidth - thumbWidth));
    else {
        transition.setByX(thumbAreaWidth - thumbWidth);
    }
    transition.setCycleCount(1);
    transition.play();
}