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


Java TranslateTransition.setCycleCount方法代码示例

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


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

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

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

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

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public Shaker(Node node) {
    tt = new TranslateTransition(Duration.millis(100), node);
    tt.setFromX(0f);
    tt.setByX(6f);
    tt.setCycleCount(4);
    tt.setAutoReverse(true);
}
 
开发者ID:m-krajcovic,项目名称:photometric-data-retriever,代码行数:8,代码来源:Shaker.java

示例14: moveTo

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/**
 * Moves this cell to the given x and y coordinates
 * @param x the x coordinate to move to
 * @param y the y coordinate to move to
 * @param animate whether to animate the transition from the old position
 * @param emphasize whether to have the Highlighter class emphasize this cell while it moves
 */
void moveTo(double x, double y, boolean animate, boolean emphasize){
    if(animate && numCellsBeingAnimated < MAX_NUM_CELLS_TO_ANIMATE){
        numCellsBeingAnimated++;

        Shape placeHolder = (Shape) getBaseView();
        placeHolder.setTranslateX(x+TreeLayout.H_PAD);
        placeHolder.setTranslateY(y+BOX_SHIFT);
        placeHolder.setOpacity(0.0);
        ((Pane)(this.getParent())).getChildren().add(placeHolder);

        TranslateTransition t = new TranslateTransition(Duration.millis(3000), this);
        t.setToX(x);
        t.setToY(y+BOX_SHIFT);
        t.setCycleCount(1);
        t.setOnFinished(event -> {
            numCellsBeingAnimated--;
            ((Pane)(this.getParent())).getChildren().remove(placeHolder);
        });
        t.play();

        if(emphasize){
            Highlighter.emphasizeCell(this);
        }
    }else{
        setTranslateX(x);
        setTranslateY(y+BOX_SHIFT);
    }
    this.refLabel.translate(x,y);
    this.hasUpdatedPosition.set(true);
    if (!this.refLabel.isVisible())
        this.refLabel.setVisible(true);
}
 
开发者ID:dmusican,项目名称:Elegit,代码行数:40,代码来源:Cell.java

示例15: applyAnimation

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void applyAnimation(final StackPane group)
 {
  
  DropShadow ds = new DropShadow();
  ds.setOffsetY(3.0f);
  ds.setColor(Color.color(0.4f, 0.4f, 0.4f));
   
  Text t = new Text();
  t.setEffect(ds);
  t.setCache(true);
  t.setFill(Color.BLUE);
  t.setText("JavaFX drop shadow...");
  t.setFont(Font.font(null, FontWeight.BOLD, 32));
  
  final TranslateTransition animation = new TranslateTransition(Duration.millis(2000), t);
     animation.setFromX(-100);
     animation.setToX(100);
     animation.setAutoReverse(true);
     animation.setCycleCount(Animation.INDEFINITE);
    
     TranslateTransition animation1 = new TranslateTransition(Duration.millis(1000), t);
     animation1.setFromX(0);
     animation1.setToX(-100);
     animation1.setAutoReverse(false);
     animation1.setCycleCount(1);
     animation1.setOnFinished(new EventHandler<ActionEvent>() {
	@Override
	public void handle(ActionEvent arg0) {
		 animation.playFromStart();
	}
});
     animation1.playFromStart();
     
     group.getChildren().add(t);
  }
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:36,代码来源:MarqueTagInJavaFX.java


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