当前位置: 首页>>代码示例>>Java>>正文


Java TranslateTransition.setToX方法代码示例

本文整理汇总了Java中javafx.animation.TranslateTransition.setToX方法的典型用法代码示例。如果您正苦于以下问题:Java TranslateTransition.setToX方法的具体用法?Java TranslateTransition.setToX怎么用?Java TranslateTransition.setToX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.animation.TranslateTransition的用法示例。


在下文中一共展示了TranslateTransition.setToX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TranslateTransitionSample

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
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();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:TranslateTransitionSample.java

示例2: initialize

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@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));
}
 
开发者ID:TheRedSpy15,项目名称:The-Trail,代码行数:24,代码来源:TravelController.java

示例3: updateGUI

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@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");
}
 
开发者ID:TheRedSpy15,项目名称:The-Trail,代码行数:19,代码来源:TravelController.java

示例4: drawerAction

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@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();
                }
            });
}
 
开发者ID:karanpratapsingh,项目名称:KenzieTheBot,代码行数:23,代码来源:MainController.java

示例5: TranslateAnimation

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
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;
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:26,代码来源:KeyFrameDragAnimator.java

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

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

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

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

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

示例12: fade

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:DeOldSax,项目名称:iliasDownloaderTool,代码行数:24,代码来源:LoginFader.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: 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

示例15: animateDrawerMove

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
static void animateDrawerMove() {
    TranslateTransition openNav = new TranslateTransition(new Duration(350), drawer);
    openNav.setToX(drawer.getWidth());
    TranslateTransition closeNav = new TranslateTransition(new Duration(350), drawer);
    
    if(drawer.getTranslateX() < drawer.getWidth()){
        openNav.play();
        
    }else{
        closeNav.setToX(-(drawer.getWidth()));
        closeNav.play();
    }
}
 
开发者ID:Obsidiam,项目名称:amelia,代码行数:14,代码来源:DrawerController.java


注:本文中的javafx.animation.TranslateTransition.setToX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。