javafx.animation.Timeline.setCycleCount()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(230)

本文整理了Java中javafx.animation.Timeline.setCycleCount()方法的一些代码示例,展示了Timeline.setCycleCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timeline.setCycleCount()方法的具体详情如下:
包路径:javafx.animation.Timeline
类名称:Timeline
方法名:setCycleCount

Timeline.setCycleCount介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Timeline fiveSecondsWonder = new Timeline(new KeyFrame(Duration.seconds(5), new EventHandler<ActionEvent>() {

  @Override
  public void handle(ActionEvent event) {
    System.out.println("this is called every 5 seconds on UI thread");
  }
}));
fiveSecondsWonder.setCycleCount(Timeline.INDEFINITE);
fiveSecondsWonder.play();

代码示例来源:origin: jfoenixadmin/JFoenix

timeline.getKeyFrames().clear();
timeline = new Timeline(blueFrame[0],
  blueFrame[1],
  blueFrame[2],
  greenFrame[3],
  endingFrame);
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.setDelay(Duration.ZERO);
timeline.playFromStart();

代码示例来源:origin: jfoenixadmin/JFoenix

closeAnimation.setCycleCount(1);
closeAnimation.setOnFinished(e -> {
  resetPseudoClass();
  processSnackbar();
});
closeAnimation.play();

代码示例来源:origin: stackoverflow.com

PseudoClass flashHighlight = PseudoClass.getPseudoClass("flash-highlight");
Node flashingNode = ... ;

Timeline flasher = new Timeline(

  new KeyFrame(Duration.seconds(0.5), e -> {
    flashingNode.pseudoClassStateChanged(flashHighlight, true);
  }),

  new KeyFrame(Duration.seconds(1.0), e -> {
    flashingNode.pseudoClassStateChanged(flashHighlight, false);
  })
);
flasher.setCycleCount(Animation.INDEFINITE);

代码示例来源:origin: stackoverflow.com

public void moveCircle(Circle circle, Scene scene) {
  Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), ev -> {
    circle.setCenterX(random((int) scene.getX()));
    circle.setCenterY(random((int) scene.getY()));
  }));
  timeline.setCycleCount(Animation.INDEFINITE);
  timeline.play();
}

代码示例来源:origin: stackoverflow.com

KeyValue start = new KeyValue(enemy.translateXProperty(), 0);
KeyValue end = new KeyValue(enemy.translateXProperty(), 600);

KeyFrame startFrame = new KeyFrame(Duration.ZERO, start);
KeyFrame endFrame = new KeyFrame(Duration.seconds(5), end);

Timeline timeline = new Timeline(startFrame, endFrame);
timeline.setAutoReverse(true);
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.play();

代码示例来源:origin: org.reactfx/reactfx

private FxTimer(java.time.Duration timeout, Runnable action, int cycles) {
  this.timeout = Duration.millis(timeout.toMillis());
  this.timeline = new Timeline();
  this.action = action;
  timeline.setCycleCount(cycles);
}

代码示例来源:origin: stackoverflow.com

timerLabel.setVisible(false);
final Timeline timeline = new Timeline();
timeline.setCycleCount(TOTALTIME);
KeyFrame keyFrame = new KeyFrame(Duration.seconds(1), e->count.set(count.get()-1));
timeline.getKeyFrames().add(keyFrame);

代码示例来源:origin: stackoverflow.com

DoubleProperty y  = new SimpleDoubleProperty();
Timeline timeline = new Timeline(
  new KeyFrame(Duration.seconds(0),
      new KeyValue(x, 0),
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.play();

代码示例来源:origin: stackoverflow.com

public void play() {
  KeyFrame kf = new KeyFrame(Duration.millis(20), e -> spin());
  Timeline tl = new Timeline(kf);
  tl.setCycleCount(randomize(10,50));
  tl.play();
  tl.setOnFinished(e -> { 
    int x = this.queue.peek().getKey(); 
    // do whatever you need to do with x here....
  });
}

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

public SeamapImageView(Image mapImage, double width, double height, Point2D focus, double scale) {
  super();
  imgView = new ImageView();
  shipCanvas = new Pane();
  shipCanvas.setId("shipCanvas");
  clip = new Rectangle(0, 0, width, height);
  Color slideColor = new Color(1, 1, 1, 0.1);
  slaveClip = new Rectangle(0, 0, width, height);
  scrollLeft = new Rectangle(0, 0, 50, height);
  scrollLeft.setFill(slideColor);
  scrollRight = new Rectangle(width - 50, 0, 50, height);
  scrollRight.setFill(slideColor);
  slideLeftAnimation = new Timeline();
  slideLeftAnimation.setCycleCount(Animation.INDEFINITE);
  KeyFrame kf1 = new KeyFrame(Duration.millis(50),
      event -> resetClipXPosition(clip.getX() - 5));
  slideLeftAnimation.getKeyFrames().add(kf1);
  slideRightAnimation = new Timeline();
  slideRightAnimation.setCycleCount(Animation.INDEFINITE);
  KeyFrame kf2 = new KeyFrame(Duration.millis(50),
      event -> resetClipXPosition(clip.getX() + 5));
  slideRightAnimation.getKeyFrames().add(kf2);
  this.mapImage = mapImage;
  this.focus = focus;
  this.scale.set(scale);
}
@PostConstruct

代码示例来源:origin: jfoenixadmin/JFoenix

final double[] derivatives = new double[frictions.length];
Timeline timeline = new Timeline();
final EventHandler<MouseEvent> dragHandler = event -> timeline.stop();
final EventHandler<ScrollEvent> scrollHandler = event -> {
      timeline.play();
timeline.setCycleCount(Animation.INDEFINITE);

代码示例来源:origin: stackoverflow.com

public void texting(String inc) {    
  IntegerProperty textLength = new IntegerProperty();
  Timeline timeline = new Timeline(new KeyFrame(Duration.millis(300)), e -> {
    textLength.set(textLength.get()+1);
    labelHeader.setText(inc.substring(0, textLength.get()));
  });
  timeline.setCycleCount(inc.length());
  timeline.play();

}

代码示例来源:origin: torakiki/pdfsam

Timeline timeline = new Timeline(new KeyFrame(Duration.millis(2500)),
    new KeyFrame(Duration.millis(0), new KeyValue(node.scaleXProperty(), 1, EASE_BOTH),
        new KeyValue(node.scaleYProperty(), 1, EASE_BOTH),
        new KeyValue(node.scaleYProperty(), 1, EASE_BOTH),
        new KeyValue(node.rotateProperty(), 0, EASE_BOTH)));
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.setDelay(Duration.millis(2000));
return timeline;

代码示例来源:origin: jfoenixadmin/JFoenix

@PostConstruct
public void init() {
  Timeline timeline = new Timeline(
    new KeyFrame(
      Duration.ZERO,
      new KeyValue(blueSpinner.progressProperty(), 0),
      new KeyValue(greenSpinner.progressProperty(), 0)
    ),
    new KeyFrame(
      Duration.seconds(0.5),
      new KeyValue(greenSpinner.progressProperty(), 0.5)
    ),
    new KeyFrame(
      Duration.seconds(2),
      new KeyValue(blueSpinner.progressProperty(), 1),
      new KeyValue(greenSpinner.progressProperty(), 1)
    )
  );
  timeline.setCycleCount(Timeline.INDEFINITE);
  timeline.play();
}

代码示例来源:origin: stackoverflow.com

new KeyFrame(duration, new KeyValue(circle.centerYProperty(), circle.getCenterY()+dy)));
animation.setAutoReverse(true);
animation.setCycleCount(Animation.INDEFINITE);
animation.play();

代码示例来源:origin: jfoenixadmin/JFoenix

/**
 * init fxml when loaded.
 */
@PostConstruct
public void init() {
  Timeline task = new Timeline(
    new KeyFrame(
      Duration.ZERO,
      new KeyValue(progress1.progressProperty(), 0),
      new KeyValue(progress2.progressProperty(), 0),
      new KeyValue(progress2.secondaryProgressProperty(), 0.5)),
    new KeyFrame(
      Duration.seconds(1),
      new KeyValue(progress2.secondaryProgressProperty(), 1)),
    new KeyFrame(
      Duration.seconds(2),
      new KeyValue(progress1.progressProperty(), 1),
      new KeyValue(progress2.progressProperty(), 1)));
  task.setCycleCount(Timeline.INDEFINITE);
  task.play();
}

代码示例来源:origin: com.jfoenix/jfoenix

closeAnimation.setCycleCount(1);
closeAnimation.setOnFinished(e -> {
  resetPseudoClass();
  processSnackbar();
});
closeAnimation.play();

代码示例来源:origin: jfoenixadmin/JFoenix

jfxBarInf.setProgress(-1.0f);
Timeline timeline = new Timeline(
  new KeyFrame(
    Duration.ZERO,
    new KeyValue(jfxBar.progressProperty(), 1)));
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.play();

代码示例来源:origin: stackoverflow.com

Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), 
   new EventHandler<ActionEvent>() {
     @Override
     public void handle(ActionEvent event) {
       snake.updatePosition();
     }
   }
 ));
 timeline.setCycleCount(Animation.INDEFINITE);
 timeline.play();

相关文章