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


Java TranslateTransition.play方法代碼示例

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


在下文中一共展示了TranslateTransition.play方法的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: 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

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

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

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

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

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

示例10: animate

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

示例11: selectedStateChanged

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

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

示例13: animatePanelMove

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void animatePanelMove() {
    TranslateTransition openNav = new TranslateTransition(new Duration(350), pane);
    openNav.setToX(pane.getWidth());
    TranslateTransition closeNav = new TranslateTransition(new Duration(350), pane);
    
    if(pane.getTranslateX() < pane.getWidth()){
        openNav.play();
    }else{
        closeNav.setToX(-(pane.getWidth()));
        closeNav.play();
    }
}
 
開發者ID:Obsidiam,項目名稱:joanne,代碼行數:13,代碼來源:FXMLDocumentController.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: animateViewMove

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
static void animateViewMove() {
    TranslateTransition openNav = new TranslateTransition(new Duration(350), lv);
    openNav.setToX(lv.getWidth());
    TranslateTransition closeNav = new TranslateTransition(new Duration(350), lv);
    
    if(lv.getTranslateX() < lv.getWidth()){
        lv.requestFocus();
        openNav.play();
    }else{
        closeNav.setToX(-(lv.getWidth()));
        closeNav.play();
    }
}
 
開發者ID:Obsidiam,項目名稱:amelia,代碼行數:14,代碼來源:LoginViewController.java


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