本文整理汇总了Java中javafx.util.Duration.ZERO属性的典型用法代码示例。如果您正苦于以下问题:Java Duration.ZERO属性的具体用法?Java Duration.ZERO怎么用?Java Duration.ZERO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.util.Duration
的用法示例。
在下文中一共展示了Duration.ZERO属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupShowAnimation
@Override
protected Timeline setupShowAnimation() {
Timeline tl = new Timeline();
// Sets opacity to 0.0 instantly which is pretty much invisible
KeyValue kvOpacity = new KeyValue(stage.opacityProperty(), 0.0);
KeyFrame frame1 = new KeyFrame(Duration.ZERO, kvOpacity);
// Sets opacity to 1.0 (fully visible) over the time of 3000 milliseconds.
KeyValue kvOpacity2 = new KeyValue(stage.opacityProperty(), 1.0);
KeyFrame frame2 = new KeyFrame(Duration.millis(3000), kvOpacity2);
tl.getKeyFrames().addAll(frame1, frame2);
tl.setOnFinished(e -> trayIsShowing = true);
return tl;
}
示例2: startAnimateForm300
private Timeline startAnimateForm300() {
Timeline tml = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(pnlContent.maxHeightProperty(), 70)),
new KeyFrame(Duration.seconds(0.4), new KeyValue(pnlContent.maxHeightProperty(), 300, Interpolator.EASE_BOTH)));
tml.setOnFinished((ActionEvent event) -> {
pnlForm.setVisible(true);
txtSend.requestFocus();
});
return tml;
}
示例3: startAnimateForm130
private Timeline startAnimateForm130() {
Timeline tml = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(pnlContent.maxHeightProperty(), 70)),
new KeyFrame(Duration.seconds(0.4), new KeyValue(pnlContent.maxHeightProperty(), 130, Interpolator.EASE_BOTH)));
tml.setOnFinished((ActionEvent event) -> {
pnlForm.setVisible(false);
pnlMessage.setVisible(true);
});
return tml;
}
示例4: startSnakeGame
/**
* Starts the timeline for the snake game and monitors the snake action
*/
private void startSnakeGame() {
hasGameStarted = true;
paused = false;
timeline = new Timeline(new KeyFrame(Duration.ZERO, new EventHandler() {
@Override
public void handle(Event event) {
if (pressedDir != null) {
snake.setNewDirection(pressedDir);
}
snake.move();
if (snake.snakeReachedFruit(fruit)) {
snakeEatsFruit();
}
if (snake.isGameOver()) {
timeline.stop();
createGameOverPane();
}
repaintPane();
}
}), new KeyFrame(Duration.millis(speed)));
if (snake.isSnakeAlive()) {
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.play();
}
}
示例5: createSeriesRemoveTimeLine
/**
* Creates an array of KeyFrames for fading out nodes representing a series
*
* @param series
* The series to remove
* @param fadeOutTime
* Time to fade out, in milliseconds
* @return array of two KeyFrames from zero to fadeOutTime
*/
final KeyFrame[] createSeriesRemoveTimeLine(Series<X, Y> series, long fadeOutTime) {
final List<Node> nodes = new ArrayList<>();
nodes.add(series.getNode());
for (Data<X, Y> d : series.getData()) {
if (d.getNode() != null) {
nodes.add(d.getNode());
}
}
// fade out series node and symbols
KeyValue[] startValues = new KeyValue[nodes.size()];
KeyValue[] endValues = new KeyValue[nodes.size()];
for (int j = 0; j < nodes.size(); j++) {
startValues[j] = new KeyValue(nodes.get(j).opacityProperty(), 1);
endValues[j] = new KeyValue(nodes.get(j).opacityProperty(), 0);
}
return new KeyFrame[] { new KeyFrame(Duration.ZERO, startValues),
new KeyFrame(Duration.millis(fadeOutTime), actionEvent -> {
getPlotChildren().removeAll(nodes);
removeSeriesFromDisplay(series);
}, endValues) };
}
示例6: setupShowAnimation
@Override
protected Timeline setupShowAnimation() {
Timeline tl = new Timeline();
// Sets the x location of the tray off the screen
double offScreenX = stage.getOffScreenBounds().getX();
KeyValue kvX = new KeyValue(stage.xLocationProperty(), offScreenX);
KeyFrame frame1 = new KeyFrame(Duration.ZERO, kvX);
// Animates the Tray onto the screen and interpolates at a tangent for 300 millis
Interpolator interpolator = Interpolator.TANGENT(Duration.millis(300), 50);
KeyValue kvInter = new KeyValue(stage.xLocationProperty(), stage.getBottomRight().getX(), interpolator);
KeyFrame frame2 = new KeyFrame(Duration.millis(1300), kvInter);
// Sets opacity to 0 instantly
KeyValue kvOpacity = new KeyValue(stage.opacityProperty(), 0.0);
KeyFrame frame3 = new KeyFrame(Duration.ZERO, kvOpacity);
// Increases the opacity to fully visible whilst moving in the space of 1000 millis
KeyValue kvOpacity2 = new KeyValue(stage.opacityProperty(), 1.0);
KeyFrame frame4 = new KeyFrame(Duration.millis(1000), kvOpacity2);
tl.getKeyFrames().addAll(frame1, frame2, frame3, frame4);
tl.setOnFinished(e -> trayIsShowing = true);
return tl;
}
示例7: ExtendedViewTrackerPlayback
public ExtendedViewTrackerPlayback(QuPathViewer viewer) {
this.viewer = viewer;
this.playing = new SimpleBooleanProperty(false);
this.timeline = new Timeline(
new KeyFrame(Duration.ZERO,
actionEvent -> ExtendedViewTrackerPlayback.this.handleUpdate(),
new KeyValue[0]), new KeyFrame(Duration.millis(50.0D)));
this.timeline.setCycleCount(-1);
this.playing.addListener((v, o, n) -> {
if (n) {
this.doStartPlayback();
} else {
this.doStopPlayback();
}
});
}
示例8: setValue
public void setValue(final double VALUE) {
if (null == value) {
if (isAnimated()) {
oldValue = _value;
_value = VALUE;
timeline.stop();
KeyValue kv1 = new KeyValue(currentValue, oldValue, Interpolator.EASE_BOTH);
KeyValue kv2 = new KeyValue(currentValue, VALUE, Interpolator.EASE_BOTH);
KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
KeyFrame kf2 = new KeyFrame(Duration.millis(animationDuration), kv2);
timeline.getKeyFrames().setAll(kf1, kf2);
timeline.play();
} else {
oldValue = _value;
_value = VALUE;
fireItemEvent(FINISHED_EVENT);
}
} else {
value.set(VALUE);
}
}
示例9: startAnimateUSSD
private Timeline startAnimateUSSD() {
Timeline ml1 = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(progress.startAngleProperty(), -180)),
new KeyFrame(Duration.seconds(1), new KeyValue(progress.startAngleProperty(), 180))
);
ml1.setCycleCount(Timeline.INDEFINITE);
return ml1;
}
示例10: setValue
public void setValue(final double VALUE) {
if (animated) {
timeline.stop();
KeyValue kv1 = new KeyValue(currentValue, value, Interpolator.EASE_BOTH);
KeyValue kv2 = new KeyValue(currentValue, VALUE, Interpolator.EASE_BOTH);
KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
KeyFrame kf2 = new KeyFrame(Duration.millis(animationDuration), kv2);
timeline.getKeyFrames().setAll(kf1, kf2);
timeline.play();
} else {
oldValue = value;
value = VALUE;
fireChartDataEvent(FINISHED_EVENT);
}
}
示例11: setValue
public void setValue(final double VALUE) {
if (animated) {
timeline.stop();
KeyValue kv1 = new KeyValue(currentValue, value, Interpolator.EASE_BOTH);
KeyValue kv2 = new KeyValue(currentValue, VALUE, Interpolator.EASE_BOTH);
KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
KeyFrame kf2 = new KeyFrame(Duration.millis(800), kv2);
timeline.getKeyFrames().setAll(kf1, kf2);
timeline.play();
} else {
value = VALUE;
fireChartDataEvent(UPDATE_EVENT);
}
}
示例12: changeInterpolator
public void changeInterpolator(Interpolator newinterpolator){
Duration currenttime = Duration.ZERO;
if (timeline!=null){
currenttime = timeline.getCurrentTime();
timeline.stop();
}
timeline = TimelineBuilder.create()
.cycleCount(Timeline.INDEFINITE)
.autoReverse(true)
.keyFrames(
new KeyFrame(
Duration.ZERO,
new KeyValue(circle1.translateXProperty(), 0, Interpolator.LINEAR),
new KeyValue(circle2.translateXProperty(), 0, Interpolator.EASE_BOTH),
new KeyValue(circle3.translateXProperty(), 0, Interpolator.EASE_IN),
new KeyValue(circle4.translateXProperty(), 0, Interpolator.EASE_OUT),
new KeyValue(circle5.translateXProperty(), 0, newinterpolator)
),
new KeyFrame(
Duration.seconds(4),
new KeyValue(circle1.translateXProperty(), 155, Interpolator.LINEAR),
new KeyValue(circle2.translateXProperty(), 155, Interpolator.EASE_BOTH),
new KeyValue(circle3.translateXProperty(), 155, Interpolator.EASE_IN),
new KeyValue(circle4.translateXProperty(), 155, Interpolator.EASE_OUT),
new KeyValue(circle5.translateXProperty(), 155, newinterpolator)
)
)
.build();
timeline.playFrom(currenttime);
}
示例13: showPopup
protected void showPopup() {
init();
isShowing = true;
VBox popupLayout = new VBox();
popupLayout.setSpacing(10);
popupLayout.setPadding(new Insets(10, 10, 10, 10));
StackPane popupContent = new StackPane();
popupContent.setPrefSize(width, height);
popupContent.getStyleClass().add("notification");
popupContent.getChildren().addAll(popupLayout);
popup = new Popup();
popup.setX(getX());
popup.setY(getY());
popup.getContent().add(popupContent);
popup.addEventHandler(MouseEvent.MOUSE_PRESSED, new WeakEventHandler<>(event -> {
fireNotificationEvent(new NotificationEvent(this, popup, NotificationEvent.NOTIFICATION_PRESSED));
hidePopUp();
}));
popups.add(popup);
// Add a timeline for popup fade out
KeyValue fadeOutBegin = new KeyValue(popup.opacityProperty(), 1.0);
KeyValue fadeOutEnd = new KeyValue(popup.opacityProperty(), 0.0);
KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin);
KeyFrame kfEnd = new KeyFrame(popupAnimationTime, fadeOutEnd);
timeline = new Timeline(kfBegin, kfEnd);
timeline.setDelay(popupLifetime);
timeline.setOnFinished(actionEvent -> Platform.runLater(() -> {
hidePopUp();
}));
if (stage.isShowing()) {
stage.toFront();
} else {
stage.show();
}
popup.show(stage);
fireNotificationEvent(new NotificationEvent(this, popup, NotificationEvent.SHOW_NOTIFICATION));
timeline.play();
}
示例14: setupShowAnimation
@Override
protected Timeline setupShowAnimation() {
Timeline tl = new Timeline();
KeyValue kv1 = new KeyValue(stage.yLocationProperty(), stage.getBottomRight().getY() + stage.getWidth());
KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
KeyValue kv2 = new KeyValue(stage.yLocationProperty(), stage.getBottomRight().getY());
KeyFrame kf2 = new KeyFrame(Duration.millis(1000), kv2);
KeyValue kv3 = new KeyValue(stage.opacityProperty(), 0.0);
KeyFrame kf3 = new KeyFrame(Duration.ZERO, kv3);
KeyValue kv4 = new KeyValue(stage.opacityProperty(), 1.0);
KeyFrame kf4 = new KeyFrame(Duration.millis(2000), kv4);
tl.getKeyFrames().addAll(kf1, kf2, kf3, kf4);
tl.setOnFinished(e -> trayIsShowing = true);
return tl;
}
示例15: onOpen
@Override
public void onOpen() {
elapsed = Duration.ZERO;
duration = new Duration(
logPlayer.getEndDate().getTime() - logPlayer.getStartDate().getTime());
Platform.runLater(() -> {
setTickMarks();
getFileField().setText(logPlayer.getLogFile().getName());
updateElapsed();
});
}