当前位置: 首页>>代码示例>>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;未经允许,请勿转载。