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


Java TranslateTransition.setToY方法代碼示例

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


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

示例1: setPlusScoreAnimation

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
/**
 * 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();
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:24,代碼來源:MainFXMLDocumentController.java

示例2: animation

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
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();

}
 
開發者ID:ESILV-FSociety,項目名稱:CardGame,代碼行數:23,代碼來源:GameOverviewController.java

示例3: deductScoreDeath

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
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();
}
 
開發者ID:AlmasB,項目名稱:FXGLGames,代碼行數:19,代碼來源:GeoWarsApp.java

示例4: getAnimationLoseLife

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
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);
}
 
開發者ID:AlmasB,項目名稱:FXGLGames,代碼行數:17,代碼來源:GameController.java

示例5: TransitionForAll

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
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);
}
 
開發者ID:PBZ-InsightR,項目名稱:Spellmonger3,代碼行數:21,代碼來源:ControllerPlay.java

示例6: animate

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
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);
    });
}
 
開發者ID:afsalashyana,項目名稱:FakeImageDetection,代碼行數:21,代碼來源:LaunchScreeenController.java

示例7: update

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
@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();
}
 
開發者ID:adisrini,項目名稱:slogo,代碼行數:27,代碼來源:TurtleView.java

示例8: HealingNumber

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
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();
}
 
開發者ID:demilich1,項目名稱:metastone,代碼行數:19,代碼來源:HealingNumber.java

示例9: autoFocusPolygonAnimated

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
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();
}
 
開發者ID:openbase,項目名稱:bco.bcozy,代碼行數:26,代碼來源:LocationPane.java

示例10: 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

示例11: createMiddleContent

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
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;
}
 
開發者ID:AlmasB,項目名稱:FXTutorials,代碼行數:21,代碼來源:MKXMenuApp.java

示例12: show

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
/**
 * 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();
}
 
開發者ID:Badmuts,項目名稱:Machiavelli,代碼行數:28,代碼來源:SpelregelsView.java

示例13: initialize

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
@Override
public void initialize(URL location, ResourceBundle resources) {
    log(CMPDL.title());
    log("Java version " + System.getProperty("java.version"));
    destinationPath.setText(System.getProperty("user.home") + File.separator + "modpack");
    if (System.getProperty("os.name").toLowerCase().contains("win")) {
        TranslateTransition transition = new TranslateTransition(Duration.seconds(1), title);
        transition.setFromY(-10);
        transition.setToY(10);
        transition.setCycleCount(Animation.INDEFINITE);
        transition.setAutoReverse(true);
        transition.play();
    }
}
 
開發者ID:Franckyi,項目名稱:CMPDL,代碼行數:15,代碼來源:InterfaceController.java

示例14: animateFrontPanelMove

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void animateFrontPanelMove(boolean isFarAway) {
    TranslateTransition openNav = new TranslateTransition(new Duration(350), front_panel);
    openNav.setToY(-front_panel.getHeight());
    TranslateTransition closeNav = new TranslateTransition(new Duration(350), front_panel);
    closeNav.setToY(0.0);
    
    if(!isFarAway){
        closeNav.play();
    }else{
        openNav.play();
    }
}
 
開發者ID:Obsidiam,項目名稱:joanne,代碼行數:13,代碼來源:FXMLDocumentController.java

示例15: animateActionPanelMove

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void animateActionPanelMove(){
    TranslateTransition openNav = new TranslateTransition(new Duration(400), ADD_PANEL);
    openNav.setToY(136 + ADD_PANEL.getHeight());
    TranslateTransition closeNav = new TranslateTransition(new Duration(400), ADD_PANEL);
    
    if(ADD_PANEL.getTranslateY() < ADD_PANEL.getHeight()){
        openNav.play();
    }else{
        closeNav.setToY(-(136 + ADD_PANEL.getHeight()));
        closeNav.play();
    }
}
 
開發者ID:Obsidiam,項目名稱:amelia,代碼行數:13,代碼來源:MainViewController.java


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