本文整理了Java中javafx.animation.Timeline.play()
方法的一些代码示例,展示了Timeline.play()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timeline.play()
方法的具体详情如下:
包路径:javafx.animation.Timeline
类名称:Timeline
方法名:play
暂无
代码示例来源: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
@Override
public <U> void setViewContext(ViewContext<U> context) {
updatePlaceholder(context.getRootNode());
if (animation != null) {
animation.stop();
}
animation = new Timeline();
animation.getKeyFrames().addAll(animationProducer.apply(this));
animation.getKeyFrames().add(new KeyFrame(duration, (e) -> clearPlaceholder()));
animation.play();
}
代码示例来源:origin: jfoenixadmin/JFoenix
closeAnimation.setCycleCount(1);
closeAnimation.setOnFinished(e -> {
resetPseudoClass();
processSnackbar();
});
closeAnimation.play();
代码示例来源:origin: stackoverflow.com
final ProgressBar bar = new ProgressBar();
final Timeline timeline = new Timeline(
new KeyFrame(Duration.millis(0), new KeyValue(bar.progressProperty(), 0)),
new KeyFrame(Duration.millis(3000), new KeyValue(bar.progressProperty(), 1))
stage.show();
timeline.play();
代码示例来源: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: jfoenixadmin/JFoenix
private void hideError() {
if (heightChanged) {
new Timeline(new KeyFrame(Duration.millis(160),
new KeyValue(translateYProperty(), 0, Interpolator.EASE_BOTH))).play();
// reset the height of text field
new Timeline(new KeyFrame(Duration.millis(160),
new KeyValue(minHeightProperty(), initHeight, Interpolator.EASE_BOTH))).play();
heightChanged = false;
}
// clear error label text
errorLabel.setText(null);
oldErrorLabelHeight = errorLabelInitHeight;
// clear error icon
errorIcon.getChildren().clear();
// reset the height of the text field
currentFieldHeight = initHeight;
// hide error container
errorContainer.setVisible(false);
errorShown = false;
}
代码示例来源: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: 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: speedment/speedment
fade.play();
final Timeline timeline = new Timeline(new KeyFrame(
TIMER, ev -> ref.get().fadeAway()
));
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: 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: pmd/pmd
private void initializeViewAnimation() {
// gets captured in the closure
final double defaultMainHorizontalSplitPaneDividerPosition
= mainHorizontalSplitPane.getDividerPositions()[0];
// show/ hide bottom pane
bottomTabsToggle.selectedProperty().addListener((observable, wasExpanded, isNowExpanded) -> {
KeyValue keyValue = null;
DoubleProperty divPosition = mainHorizontalSplitPane.getDividers().get(0).positionProperty();
if (wasExpanded && !isNowExpanded) {
keyValue = new KeyValue(divPosition, 1);
} else if (!wasExpanded && isNowExpanded) {
keyValue = new KeyValue(divPosition, defaultMainHorizontalSplitPaneDividerPosition);
}
if (keyValue != null) {
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(200), keyValue));
timeline.play();
}
});
}
代码示例来源: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: 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: jfoenixadmin/JFoenix
public void show() {
dialog.setOpacity(0);
// pickerDecorator.setOpacity(0);
if (dialog.getOwner() != null) {
dialog.widthProperty().addListener(positionAdjuster);
dialog.heightProperty().addListener(positionAdjuster);
positionAdjuster.invalidated(null);
}
if (dialog.getScene() == null) {
dialog.setScene(customScene);
}
curvedColorPicker.preAnimate();
dialog.show();
if (initOnce) {
initRun.run();
initOnce = false;
}
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(120),
new KeyValue(dialog.opacityProperty(),
1,
Interpolator.EASE_BOTH)));
timeline.setOnFinished((finish) -> curvedColorPicker.animate());
timeline.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: jfoenixadmin/JFoenix
newHeight,
Interpolator.EASE_BOTH)));
errorAnimation.play();
errorAnimation.setOnFinished(finish -> new Timeline(new KeyFrame(Duration.millis(160),
new KeyValue(errorContainer.opacityProperty(),
1,
Interpolator.EASE_BOTH))).play());
currentFieldHeight = newHeight;
oldErrorLabelHeight = newVal.doubleValue();
errorContainer.visibleProperty().addListener((o, oldVal, newVal) -> {
new Timeline(new KeyFrame(Duration.millis(160),
new KeyValue(errorContainer.opacityProperty(),
1,
Interpolator.EASE_BOTH))).play();
});
hideErrorAnimation = new Timeline(new KeyFrame(Duration.millis(160),
new KeyValue(errorContainer.opacityProperty(),
0,
JFXUtilities.runInFX(() -> showError(newVal));
});
hideErrorAnimation.play();
} else {
JFXUtilities.runInFX(this::hideError);
代码示例来源: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: jfoenixadmin/JFoenix
gapAnimation = new Timeline(
new KeyFrame(Duration.millis(240),
new KeyValue(this.translateYProperty(),
Interpolator.EASE_BOTH)
));
gapAnimation.play();
gapAnimation.setOnFinished((finish) -> {
requestLayout();
代码示例来源:origin: stackoverflow.com
Timeline animation = new Timeline(
new KeyFrame(Duration.millis(500), e -> list.getSelectionModel().selectNext()));
list.getSelectionModel().select(0);
animation.setCycleCount(list.getItems().size()-1);
animation.play();
内容来源于网络,如有侵权,请联系作者删除!