當前位置: 首頁>>代碼示例>>Java>>正文


Java Duration.ZERO屬性代碼示例

本文整理匯總了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;
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:18,代碼來源:FadeAnimation.java

示例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;
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:10,代碼來源:USSDGUIController.java

示例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;
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:12,代碼來源:USSDGUIController.java

示例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();
	}
}
 
開發者ID:sanijablan,項目名稱:M426_Scrum,代碼行數:29,代碼來源:SnakeGameGUI.java

示例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) };
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:30,代碼來源:MultiAxisChart.java

示例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;
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:28,代碼來源:SlideAnimation.java

示例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();
        }

    });
}
 
開發者ID:Alanocallaghan,項目名稱:qupath-tracking-extension,代碼行數:17,代碼來源:ExtendedViewTrackerPlayback.java

示例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);
    }
}
 
開發者ID:HanSolo,項目名稱:charts,代碼行數:21,代碼來源:ChartItem.java

示例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;
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:8,代碼來源:USSDGUIController.java

示例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);
    }
}
 
開發者ID:HanSolo,項目名稱:SunburstChart,代碼行數:15,代碼來源:ChartData.java

示例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);
    }
}
 
開發者ID:HanSolo,項目名稱:radialchart,代碼行數:14,代碼來源:ChartData.java

示例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);
    
    
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:34,代碼來源:InterpolatorSample.java

示例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();
}
 
開發者ID:Team-Sprout,項目名稱:Clipcon-Client,代碼行數:47,代碼來源:ClipboardNotification.java

示例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;
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:22,代碼來源:PopupAnimation.java

示例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();
  });
}
 
開發者ID:BITPlan,項目名稱:can4eve,代碼行數:11,代碼來源:SimulatorPane.java


注:本文中的javafx.util.Duration.ZERO屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。