本文整理了Java中javafx.animation.Timeline.currentTimeProperty()
方法的一些代码示例,展示了Timeline.currentTimeProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timeline.currentTimeProperty()
方法的具体详情如下:
包路径:javafx.animation.Timeline
类名称:Timeline
方法名:currentTimeProperty
暂无
代码示例来源:origin: stackoverflow.com
@Override
public void start(Stage primaryStage) throws Exception {
SimpleStringProperty testProperty = new SimpleStringProperty();
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(1000), new KeyValue(testProperty, "1234")));
timeline.setCycleCount(Timeline.INDEFINITE);
// ----------------------------------------------------------------------
// we create our own property for the actual cycle-index
// ----------------------------------------------------------------------
SimpleIntegerProperty actualCycleProperty = new SimpleIntegerProperty(0);
timeline.currentTimeProperty().addListener((observable, oldValue, newValue) -> {
boolean smaller = newValue.toMillis() < oldValue.toMillis();
boolean evenCycleCount = actualCycleProperty.get() % 2 == 0;
if ((timeline.isAutoReverse() && !evenCycleCount && !smaller)
|| ((evenCycleCount || !timeline.isAutoReverse()) && smaller)) {
actualCycleProperty.set(actualCycleProperty.get() + 1);
}
});
actualCycleProperty.addListener((observable, oldValue, newValue) -> {
System.out.println(newValue);
});
timeline.play();
}
代码示例来源:origin: org.copper-engine/copper-monitoring-client
private void setupAnnimationTab() {
timeline = new Timeline();
timeline.setAutoReverse(false);
timeline.currentTimeProperty().addListener(new ChangeListener<Duration>() {
@Override
public void changed(ObservableValue<? extends Duration> observable, Duration oldValue, Duration newValue) {
内容来源于网络,如有侵权,请联系作者删除!