当前位置: 首页>>代码示例>>Java>>正文


Java Duration.millis方法代码示例

本文整理汇总了Java中javafx.util.Duration.millis方法的典型用法代码示例。如果您正苦于以下问题:Java Duration.millis方法的具体用法?Java Duration.millis怎么用?Java Duration.millis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.util.Duration的用法示例。


在下文中一共展示了Duration.millis方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupShowAnimation

import javafx.util.Duration; //导入方法依赖的package包/类
@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,代码行数:19,代码来源:FadeAnimation.java

示例2: setupDismissAnimation

import javafx.util.Duration; //导入方法依赖的package包/类
@Override
protected Timeline setupDismissAnimation() {
    Timeline tl = new Timeline();

    KeyValue kv1 = new KeyValue(stage.yLocationProperty(), stage.getY() + stage.getWidth());
    KeyFrame kf1 = new KeyFrame(Duration.millis(2000), kv1);

    KeyValue kv2 = new KeyValue(stage.opacityProperty(), 0.0);
    KeyFrame kf2 = new KeyFrame(Duration.millis(2000), kv2);

    tl.getKeyFrames().addAll(kf1, kf2);

    tl.setOnFinished(e -> {
        trayIsShowing = false;
        stage.close();
        stage.setLocation(stage.getBottomRight());
    });

    return tl;
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:21,代码来源:PopupAnimation.java

示例3: Framework

import javafx.util.Duration; //导入方法依赖的package包/类
public Framework(int width, int height) {

        this.setWidth(width);
        this.setHeight(height);
        random = new Random();
        bullets = new ArrayList<>();
        tanks = new ArrayList<>();
        mines = new ArrayList<>();
        pickUps = new ArrayList<>();
        hud = new HUD(this);

        canvas = new Canvas(width, height);
        gc = canvas.getGraphicsContext2D();
        canvas.setWidth(width);
        canvas.setHeight(height);
        this.getChildren().add(canvas);

        //Create Game Loop
        gameloop = new Timeline(new KeyFrame(
                Duration.millis(16.666666666667),
                ae -> update()));
        gameloop.setCycleCount(Timeline.INDEFINITE);

        //Set SCALE to current scale of Canvas
        SCALE = this.getScaleX();

        //Make the Canvas register keystrokes
        this.addEventFilter(MouseEvent.ANY, (e) -> this.requestFocus());

        //Set Inputs
        setKeyInput();
        setMouseInput();
    }
 
开发者ID:TheBromo,项目名称:netTanks,代码行数:34,代码来源:Framework.java

示例4: createFullTransition

import javafx.util.Duration; //导入方法依赖的package包/类
private SequentialTransition createFullTransition() {
    PauseTransition delayBetweenSoundStartAndAnimationStartTransition = new PauseTransition(
            Duration.millis(animationDelayDuration));
    delayBetweenSoundStartAndAnimationStartTransition
            .setOnFinished(actionEvent -> log.debug("finished delayBetweenSoundStartAndAnimationStartTransition"));

    PauseTransition delayAfterAnimationEndsBeforeStartingNextRoundTransition = new PauseTransition(
            Duration.millis(delayBeforeNextRoundDuration));
    delayAfterAnimationEndsBeforeStartingNextRoundTransition.setOnFinished(
            actionEvent -> log.debug("finished delayAfterAnimationEndsBeforeStartingNextRoundTransition"));

    FadeTransition fadeInTransition = createFadeInTransition();

    Transition scaleTransition = createScaleTransition();

    ParallelTransition animationTransition = new ParallelTransition();
    animationTransition.getChildren().add(fadeInTransition);
    animationTransition.getChildren().add(scaleTransition);
    animationTransition.setOnFinished(actionEvent -> log.debug("finished animationTransition"));

    SequentialTransition fullTransition = new SequentialTransition();
    fullTransition.getChildren().add(delayBetweenSoundStartAndAnimationStartTransition);
    fullTransition.getChildren().add(animationTransition);
    fullTransition.getChildren().add(delayAfterAnimationEndsBeforeStartingNextRoundTransition);
    return fullTransition;
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:27,代码来源:Bravo.java

示例5: seriesAdded

import javafx.util.Duration; //导入方法依赖的package包/类
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:AdvCandleStickChartSample.java

示例6: setValue

import javafx.util.Duration; //导入方法依赖的package包/类
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,代码行数:22,代码来源:ChartItem.java

示例7: FadeOutRightTransition

import javafx.util.Duration; //导入方法依赖的package包/类
/**
 * Create new FadeOutRightTransition
 * 
 * @param node The node to affect
 */
public FadeOutRightTransition(final Node node) {
    super(
        node,
        new Timeline(
                new KeyFrame(Duration.millis(0),    
                    new KeyValue(node.opacityProperty(), 1, WEB_EASE),
                    new KeyValue(node.translateXProperty(), 0, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(1000),    
                    new KeyValue(node.opacityProperty(), 0, WEB_EASE),
                    new KeyValue(node.translateXProperty(), 20, WEB_EASE)
                )
            )
        );
    setCycleDuration(Duration.seconds(1));
    setDelay(Duration.seconds(0.2));
}
 
开发者ID:EricCanull,项目名称:fxexperience2,代码行数:23,代码来源:FadeOutRightTransition.java

示例8: scaleFromTo

import javafx.util.Duration; //导入方法依赖的package包/类
private static ScaleTransition scaleFromTo(Node node, double from, double to, int delayMillis) {
    ScaleTransition scale = new ScaleTransition(Duration.millis(UI_ANIMATION_TIME_MSEC / 2), node);
    scale.setFromX(from);
    scale.setFromY(from);
    scale.setToX(to);
    scale.setToY(to);
    scale.setDelay(Duration.millis(delayMillis));
    scale.play();
    return scale;
}
 
开发者ID:Techsoul192,项目名称:legendary-guide,代码行数:11,代码来源:GuiUtils.java

示例9: configureTimeline

import javafx.util.Duration; //导入方法依赖的package包/类
private void configureTimeline() {
    time.setCycleCount(Timeline.INDEFINITE);
    KeyFrame keyFrame = new KeyFrame(Duration.millis(47), new EventHandler<ActionEvent>() {

        public void handle(ActionEvent event) {
            calculate();
        }
    });
    time.getKeyFrames().add(keyFrame);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:StopWatch.java

示例10: initialize

import javafx.util.Duration; //导入方法依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    propertyCollector = PropertyCollector.create();

    if (!propertyCollector.isJDKCorrect() && propertyCollector.getProperty("jdk") == null) {
        createProject.setDisable(true);
    }

    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(2000), coconutPng);
    scaleTransition.setToX(1.1f);
    scaleTransition.setToY(1.1f);
    scaleTransition.setCycleCount(Timeline.INDEFINITE);
    scaleTransition.setAutoReverse(true);
    scaleTransition.play();
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:16,代码来源:StartPresenter.java

示例11: setValue

import javafx.util.Duration; //导入方法依赖的package包/类
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,代码行数:16,代码来源:ChartData.java

示例12: zoom

import javafx.util.Duration; //导入方法依赖的package包/类
private static void zoom(Node node, double scaleFrom, double scaleTo, double opacity, EventHandler<ActionEvent> eventHandler) {
    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(200), node);
    scaleTransition.setToX(scaleTo);
    scaleTransition.setToY(scaleTo);
    scaleTransition.setFromX(scaleFrom);
    scaleTransition.setFromY(scaleFrom);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(200), node);
    fadeTransition.setFromValue(opacity);
    fadeTransition.setToValue(1D - opacity);
    ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
    parallelTransition.play();
    parallelTransition.setOnFinished(eventHandler);
}
 
开发者ID:IzzelAliz,项目名称:LCL,代码行数:14,代码来源:ZoomTransition.java

示例13: updateState

import javafx.util.Duration; //导入方法依赖的package包/类
private void updateState() {
    upBar.setStyle(getSkinnable().getEnergized() ? "-fx-background-color:-energized-color" : "-fx-background-color:-de-energized-color");
    downBar.setStyle(getSkinnable().getEnergized() ? "-fx-background-color:-energized-color" : "-fx-background-color:-de-energized-color");
    mobileBar.setStyle(getSkinnable().getEnergized() ? "-fx-background-color:-energized-color" : "-fx-background-color:-de-energized-color");

    if (getSkinnable().getAnimated()) {
        timeline.stop();
        final KeyValue KEY_VALUE = new KeyValue(barRotate.angleProperty(), getSkinnable().getClosed() ? ANGLE_IN_CLOSED_POSITION : angleInOpenPosition, Interpolator.EASE_BOTH);
        final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
        timeline.getKeyFrames().setAll(KEY_FRAME);
        timeline.play();
    } else {
        barRotate.setAngle(getSkinnable().getClosed() ? ANGLE_IN_CLOSED_POSITION : angleInOpenPosition);
    }
}
 
开发者ID:assemblits,项目名称:dynamo,代码行数:16,代码来源:SwitchSkin.java

示例14: animiereBall

import javafx.util.Duration; //导入方法依赖的package包/类
public Pane animiereBall() {
    animationPane = new Pane();
    animationPane.setPrefSize(pb, ph);

    circle = new Circle(x, y, r, color);

    Timeline timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);

    KeyFrame moveBall = new KeyFrame(Duration.millis(intervall), new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            if (((circle.getCenterX() + dx < r) && (dx < 0)) || ((circle.getCenterX() + dx > animationPane.getWidth() - r) && (dx > 0))) {
                dx = -dx;
            }
            circle.setCenterX(circle.getCenterX() + dx);
            
            if (((circle.getCenterY() + dy < r) && (dy < 0)) || ((circle.getCenterY() + dy > animationPane.getHeight() - r) && (dy > 0))) {
                dy = -dy;
            }
            circle.setCenterY(circle.getCenterY() + dy);
        }
    });

    timeline.getKeyFrames().add(moveBall);
    timeline.play();

    HBox hBox = this.navigiereAnimation(timeline);

    animationPane.getChildren().addAll(circle, hBox);

    return animationPane;
}
 
开发者ID:CAPTNCAPS,项目名称:java.IF17wi,代码行数:33,代码来源:Ball.java

示例15: blurOut

import javafx.util.Duration; //导入方法依赖的package包/类
public static void blurOut(Node node) {
    GaussianBlur blur = new GaussianBlur(0.0);
    node.setEffect(blur);
    Timeline timeline = new Timeline();
    KeyValue kv = new KeyValue(blur.radiusProperty(), 10.0);
    KeyFrame kf = new KeyFrame(Duration.millis(UI_ANIMATION_TIME_MSEC), kv);
    timeline.getKeyFrames().add(kf);
    timeline.play();
}
 
开发者ID:Techsoul192,项目名称:legendary-guide,代码行数:10,代码来源:GuiUtils.java


注:本文中的javafx.util.Duration.millis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。