當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。