Java 类javafx.animation.Timeline 实例源码

项目:boomer-tuner    文件:Player.java   
private void playCrossfade(final List<? extends Playable> items, final int index) {
    MediaPlayer oldPlayer = currentPlayer;
    final double currentVolume = oldPlayer.getVolume();
    oldPlayer.volumeProperty().unbind();
    playQueue = new ArrayList<>(items);
    currentIndex = index;

    MediaPlayer newPlayer = new MediaPlayer(new Media(playQueue.get(currentIndex).getUri().toString()));
    newPlayer.setVolume(0);
    newPlayer.play();
    Timeline crossfade = new Timeline(new KeyFrame(Duration.seconds(CROSSFADE_DURATION),
            new KeyValue(oldPlayer.volumeProperty(), 0),
            new KeyValue(newPlayer.volumeProperty(), currentVolume)));
    crossfade.setOnFinished(event -> {
        oldPlayer.stop();
        setCurrentPlayer(newPlayer);
    });
    crossfade.play();
}
项目:java.IF17wi    文件:Rechteck.java   
public static Pane animiereRechteck() {

        Random random = new Random();

        Pane animationPane = new Pane();
        animationPane.setPrefSize(500,200);

        Rectangle rect = new Rectangle(75, 75, 100, 50);
        animationPane.getChildren().add(rect);

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

        KeyValue kVMoveX = new KeyValue(rect.xProperty(), random.nextInt(200) + 200);
        KeyValue kVRotate = new KeyValue(rect.rotateProperty(), random.nextInt(360) + 180);
        KeyValue kVArcHeight = new KeyValue(rect.arcHeightProperty(), 60);
        KeyValue kVArcWidth = new KeyValue(rect.arcWidthProperty(), 60);

        KeyFrame keyFrame = new KeyFrame(Duration.millis(random.nextInt(2000) + 2000), kVMoveX, kVRotate, kVArcHeight, kVArcWidth);

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

        return animationPane;
    }
项目:SunburstChart    文件:ChartData.java   
public ChartData(final String NAME, final double VALUE, final Color FILL_COLOR, final Color STROKE_COLOR, final Color TEXT_COLOR, final Instant TIMESTAMP, final boolean ANIMATED, final long ANIMATION_DURATION) {
    name              = NAME;
    value             = VALUE;
    oldValue          = 0;
    fillColor         = FILL_COLOR;
    strokeColor       = STROKE_COLOR;
    textColor         = TEXT_COLOR;
    timestamp         = TIMESTAMP;
    currentValue      = new DoublePropertyBase(value) {
        @Override protected void invalidated() {
            oldValue = value;
            value = get();
            fireChartDataEvent(UPDATE_EVENT);
        }
        @Override public Object getBean() { return ChartData.this; }
        @Override public String getName() { return "currentValue"; }
    };
    timeline          = new Timeline();
    animated          = ANIMATED;
    animationDuration = ANIMATION_DURATION;

    timeline.setOnFinished(e -> fireChartDataEvent(FINISHED_EVENT));
}
项目:BatpackJava    文件:batteryMonitorLayoutController.java   
private void bindUpdates() {
    final KeyFrame oneFrame = new KeyFrame(Duration.seconds(1), (ActionEvent evt) -> {
        if (this.batpack != null) {
            this.batpack = BatteryMonitorSystem.getBatpack();
            //System.out.println("layout: battery pack module 5 cell 5 voltage: " + batpack.getModules().get(4).getBatteryCells().get(4).getVoltageAsString());
            checkConnection();
            updateModules();
            updateTotalVoltage();
            updateMaxTemperature();
            updateCriticalValues();
        }

    });
    Timeline timer = TimelineBuilder.create().cycleCount(Animation.INDEFINITE).keyFrames(oneFrame).build();
    timer.playFromStart();
}
项目:marathonv5    文件:KeyStrokeMotion.java   
private void createLetter(String c) {
    final Text letter = new Text(c);
    letter.setFill(Color.BLACK);
    letter.setFont(FONT_DEFAULT);
    letter.setTextOrigin(VPos.TOP);
    letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
    letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
    getChildren().add(letter);
    // over 3 seconds move letter to random position and fade it out
    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(
            new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent event) {
                    // we are done remove us from scene
                    getChildren().remove(letter);
                }
            },
            new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
            new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
            new KeyValue(letter.opacityProperty(), 0f)
    ));
    timeline.play();
}
项目:marathonv5    文件:KeyStrokeMotion.java   
private void createLetter(String c) {
    final Text letter = new Text(c);
    letter.setFill(Color.BLACK);
    letter.setFont(FONT_DEFAULT);
    letter.setTextOrigin(VPos.TOP);
    letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2);
    letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2);
    getChildren().add(letter);
    // over 3 seconds move letter to random position and fade it out
    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(
            new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
                @Override public void handle(ActionEvent event) {
                    // we are done remove us from scene
                    getChildren().remove(letter);
                }
            },
            new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR),
            new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR),
            new KeyValue(letter.opacityProperty(), 0f)
    ));
    timeline.play();
}
项目:EistReturns    文件:Utils.java   
private static void makeText(Stage ownerStage, String toastMsg, int toastDelay) {
    Stage toastStage = new Stage();
    toastStage.initOwner(ownerStage);
    toastStage.setResizable(false);
    toastStage.initStyle(StageStyle.TRANSPARENT);

    Text text = new Text(toastMsg);
    text.setFont(Font.font("Verdana", 20));
    text.setFill(Color.BLACK);

    StackPane root = new StackPane(text);
    root.setStyle("-fx-background-radius: 20; -fx-background-color: rgba(255, 255, 255, 0.9); -fx-padding: 20px;");
    root.setOpacity(0);

    Scene scene = new Scene(root);
    scene.setFill(Color.TRANSPARENT);
    toastStage.setScene(scene);
    toastStage.show();

    Timeline fadeInTimeline = new Timeline();
    KeyFrame fadeInKey1 = new KeyFrame(Duration.millis(200), new KeyValue(toastStage.getScene().getRoot().opacityProperty(), 1));
    fadeInTimeline.getKeyFrames().add(fadeInKey1);
    fadeInTimeline.setOnFinished((ae) -> new Thread(() -> {
        try {
            Thread.sleep(toastDelay);
        } catch (InterruptedException e) {

            e.printStackTrace();
        }
        Timeline fadeOutTimeline = new Timeline();
        KeyFrame fadeOutKey1 = new KeyFrame(Duration.millis(500), new KeyValue(toastStage.getScene().getRoot().opacityProperty(), 0));
        fadeOutTimeline.getKeyFrames().add(fadeOutKey1);
        fadeOutTimeline.setOnFinished((aeb) -> toastStage.close());
        fadeOutTimeline.play();
    }).start());
    fadeInTimeline.play();
}
项目:MultiAxisCharts    文件:MultiAxisAreaChart.java   
@Override
protected void seriesRemoved(final MultiAxisChart.Series<X, Y> series) {
    updateDefaultColorIndex(series);
    // remove series Y multiplier
    seriesYMultiplierMap.remove(series);
    // remove all symbol nodes
    if (shouldAnimate()) {
        Timeline tl = new Timeline(createSeriesRemoveTimeLine(series, 400));
        tl.play();
    } else {
        getPlotChildren().remove(series.getNode());
        for (Data<X, Y> d : series.getData())
            getPlotChildren().remove(d.getNode());
        removeSeriesFromDisplay(series);
    }
}
项目:CapsLock    文件:OverLayWindow.java   
void Exe(int i) {
    if(i==1) {
        warnmesse="プレイ開始から5分経過しました\n混雑している場合は次の人に\n交代してください";
        fontsize=25;
    }else if(i==2) {
        warnmesse="プレイ開始から10分経過しました\n混雑している場合は次の人に\n交代してください";
        fontsize=25;
    }else if(i==-1) {
        warnmesse="user timer is reset";
        fontsize=35;
    }

    final Stage primaryStage = new Stage(StageStyle.TRANSPARENT);
    primaryStage.initModality(Modality.NONE);
    final StackPane root = new StackPane();

    final Scene scene = new Scene(root, 350, 140);
    scene.setFill(null);

    final Label label = new Label(warnmesse);
    label.setFont(new Font("Arial", fontsize));
    BorderPane borderPane = new BorderPane();
    borderPane.setCenter(label);
    borderPane.setStyle("-fx-background-radius: 10;-fx-background-color: rgba(0,0,0,0.3);");

    root.getChildren().add(borderPane);

    final Rectangle2D d = Screen.getPrimary().getVisualBounds();
    primaryStage.setScene(scene);
    primaryStage.setAlwaysOnTop(true);
    primaryStage.setX(d.getWidth()-350);
    primaryStage.setY(d.getHeight()-300);

    primaryStage.show();

    final Timeline timer = new Timeline(new KeyFrame(Duration.seconds(CLOSE_SECONDS), (ActionEvent event) -> primaryStage.close()));
    timer.setCycleCount(Timeline.INDEFINITE);
    timer.play();
}
项目:CyberTigerScoreboard    文件:CPscorereport.java   
@Override
public void start(Stage mainWin) throws IOException {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    DEFAULT_HEIGHT = screenSize.height - 100;
    DEFAULT_WIDTH = screenSize.width - 100;

    teamTabs = new TabPane(); // Initialize the pane with for the tabs
    setUpHelp = new GUIHelper(this); // Initialize the GUI helper class
    info = setUpHelp.createTextBox("Server not configured!"); // Initialize the textbox
    menuBar = setUpHelp.getMenu(info); // Initialize the menubar and the menus
    elementSect = new StackPane(); // Initialize the element stackpane
    elementSect.getChildren().add(teamTabs); // Add the tabs from teamtabs there
    borderPane = new BorderPane(); // Add the border pane
    borderPane.setTop(menuBar); // Add stuff to the borders
    borderPane.setCenter(elementSect); // But the elementSect in the middle
    borderPane.setBottom(info); // Put the textpane in the bottom
    Scene scene = new Scene(borderPane, DEFAULT_WIDTH, DEFAULT_HEIGHT); // Create the scene for the height
    mainWin.getIcons().add(new Image(ICON_LOC)); // Set the icon as the CyberTiger icon
    mainWin.setTitle("CyberTiger Scoreboard"); // Get the window name
    mainWin.setScene(scene); // Set the window
    mainWin.show(); // Show the window

    refreshData(); // Refresh the data since this creates the rest of teh GUI

    Timeline scoreboardRefresh = new Timeline(new KeyFrame(Duration.seconds(REFRESH_TIMEOUT), (ActionEvent event) -> {
        try {
            refreshData(); // Put the refresh method in this method to autorefresh every minute
        } catch (IOException ex) { // Catch the exception from the database conn
            info.setText("Error refreshing scores! " + ex); // Show the errors
        }
    }));
    scoreboardRefresh.setCycleCount(Timeline.INDEFINITE); // Set the number of times to run
    scoreboardRefresh.play(); // Run the timer
}
项目:recruitervision    文件:PopupAnimation.java   
@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;
}
项目:fxexperience2    文件:ShakeTransition.java   
/**
 * Create new ShakeTransition
 *
 * @param node The node to affect
 */
public ShakeTransition(final Node node) {
    super(
            node,
            new Timeline(
                    new KeyFrame(Duration.millis(0), new KeyValue(node.translateXProperty(), 0, WEB_EASE)),
                    new KeyFrame(Duration.millis(100), new KeyValue(node.translateXProperty(), -10, WEB_EASE)),
                    new KeyFrame(Duration.millis(200), new KeyValue(node.translateXProperty(), 10, WEB_EASE)),
                    new KeyFrame(Duration.millis(300), new KeyValue(node.translateXProperty(), -10, WEB_EASE)),
                    new KeyFrame(Duration.millis(400), new KeyValue(node.translateXProperty(), 10, WEB_EASE)),
                    new KeyFrame(Duration.millis(500), new KeyValue(node.translateXProperty(), -10, WEB_EASE)),
                    new KeyFrame(Duration.millis(600), new KeyValue(node.translateXProperty(), 10, WEB_EASE)),
                    new KeyFrame(Duration.millis(700), new KeyValue(node.translateXProperty(), -10, WEB_EASE)),
                    new KeyFrame(Duration.millis(800), new KeyValue(node.translateXProperty(), 10, WEB_EASE)),
                    new KeyFrame(Duration.millis(900), new KeyValue(node.translateXProperty(), -10, WEB_EASE)),
                    new KeyFrame(Duration.millis(1000), new KeyValue(node.translateXProperty(), 0, WEB_EASE))
            )
    );
    setCycleDuration(Duration.seconds(1));
    setDelay(Duration.seconds(0.2));
}
项目:charts    文件:ChartItem.java   
public ChartItem(final String NAME, final double VALUE, final Color FILL, final Color STROKE, final Color TEXT_COLOR, final Instant TIMESTAMP, final boolean ANIMATED, final long ANIMATION_DURATION) {
    _name             = NAME;
    _value            = VALUE;
    oldValue          = 0;
    _fill             = FILL;
    _stroke           = STROKE;
    _textColor        = TEXT_COLOR;
    _timestamp        = TIMESTAMP;
    _symbol           = Symbol.NONE;
    _animated         = ANIMATED;
    currentValue      = new DoublePropertyBase(_value) {
        @Override protected void invalidated() {
            oldValue = getValue();
            setValue(get());
            fireItemEvent(UPDATE_EVENT);
        }
        @Override public Object getBean() { return ChartItem.this; }
        @Override public String getName() { return "currentValue"; }
    };
    timeline          = new Timeline();
    animationDuration = ANIMATION_DURATION;

    timeline.setOnFinished(e -> fireItemEvent(FINISHED_EVENT));
}
项目:fxexperience2    文件:FadeInUpTransition.java   
/**
 * Create new FadeInUpTransition
 * 
 * @param node The node to affect
 */
public FadeInUpTransition(final Node node) {
    super(
        node,
          new Timeline(
                new KeyFrame(Duration.millis(0),    
                    new KeyValue(node.opacityProperty(), 0, WEB_EASE),
                    new KeyValue(node.translateYProperty(), 20, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(1000),    
                    new KeyValue(node.opacityProperty(), 1, WEB_EASE),
                    new KeyValue(node.translateYProperty(), 0, WEB_EASE)
                )
            )
        );
    setCycleDuration(Duration.seconds(1));
    setDelay(Duration.seconds(0.2));
}
项目:phone-simulator    文件:USSDGUIController.java   
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;
}
项目:fx-animation-editor    文件:DragBehavior.java   
private void startPanAnimation(double velocity, Timeline timeline, DoubleProperty animatedPan, DoubleProperty pan) {
    if (isRunning(timeline)) {
        return;
    }
    double durationInMillis = 1e10;
    double distance = velocity * durationInMillis;
    animatedPan.set(pan.get());
    KeyValue keyValue = new KeyValue(animatedPan, animatedPan.get() - distance);
    KeyFrame keyFrame = new KeyFrame(Duration.millis(durationInMillis), keyValue);
    timeline.getKeyFrames().setAll(keyFrame);
    timeline.playFromStart();
}
项目:fxexperience2    文件:RotateInDownRightTransition.java   
@Override protected void starting() {
    super.starting();
    rotate = new Rotate(0,
            node.getBoundsInLocal().getWidth(),
            node.getBoundsInLocal().getHeight());
    timeline = new Timeline(
            new KeyFrame(Duration.millis(0),    
                new KeyValue(node.opacityProperty(), 0, WEB_EASE),
                new KeyValue(rotate.angleProperty(), 90, WEB_EASE)
            ),
            new KeyFrame(Duration.millis(1000),    
                new KeyValue(node.opacityProperty(), 1, WEB_EASE),
                new KeyValue(rotate.angleProperty(), 0, WEB_EASE)
            )
        );
    node.getTransforms().add(rotate);
}
项目:fxexperience2    文件:RotateOutUpRightTransition.java   
@Override protected void starting() {
    super.starting();
    rotate = new Rotate(0,
            node.getBoundsInLocal().getWidth(),
            node.getBoundsInLocal().getHeight());
    timeline = new Timeline(
            new KeyFrame(Duration.millis(0),    
                new KeyValue(node.opacityProperty(), 1, WEB_EASE),
                new KeyValue(rotate.angleProperty(), 0, WEB_EASE)
            ),
            new KeyFrame(Duration.millis(1000),    
                new KeyValue(node.opacityProperty(), 0, WEB_EASE),
                new KeyValue(rotate.angleProperty(), 90, WEB_EASE)
            )
        );
    node.getTransforms().add(rotate);
}
项目:fxexperience2    文件:PulseTransition.java   
/**
 * Create new PulseTransition
 * 
 * @param node The node to affect
 */
public PulseTransition(final Node node) {
    super(
        node,
      new Timeline(
                new KeyFrame(Duration.millis(0), 
                    new KeyValue(node.scaleXProperty(), 1, WEB_EASE),
                    new KeyValue(node.scaleYProperty(), 1, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(500), 
                    new KeyValue(node.scaleXProperty(), 1.1, WEB_EASE),
                    new KeyValue(node.scaleYProperty(), 1.1, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(1000), 
                    new KeyValue(node.scaleXProperty(), 1, WEB_EASE),
                    new KeyValue(node.scaleYProperty(), 1, WEB_EASE)
                )
            )
        );
    setCycleDuration(Duration.seconds(1));
    setDelay(Duration.seconds(0.2));
}
项目:incubator-netbeans    文件:TransitionRotate.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 140,140));

    Rectangle rect = new Rectangle(20, 20, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.ORANGE);
    root.getChildren().add(rect);

    rotateTransition = RotateTransitionBuilder.create()
            .node(rect)
            .duration(Duration.seconds(4))
            .fromAngle(0)
            .toAngle(720)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:fxexperience2    文件:RotateOutDownRightTransition.java   
@Override protected void starting() {
    super.starting();
    rotate = new Rotate(0,
            node.getBoundsInLocal().getWidth(),
            node.getBoundsInLocal().getHeight());
    timeline = new Timeline(
            new KeyFrame(Duration.millis(0),    
                new KeyValue(node.opacityProperty(), 1, WEB_EASE),
                new KeyValue(rotate.angleProperty(), 0, WEB_EASE)
            ),
            new KeyFrame(Duration.millis(1000),    
                new KeyValue(node.opacityProperty(), 0, WEB_EASE),
                new KeyValue(rotate.angleProperty(), -90, WEB_EASE)
            )
        );
    node.getTransforms().add(rotate);
}
项目:fxexperience2    文件:BounceOutRightTransition.java   
@Override protected void starting() {
    double endX = node.getScene().getWidth() - node.localToScene(0, 0).getX();
       timeline = new Timeline(
                new KeyFrame(Duration.millis(0),    
                    new KeyValue(node.translateXProperty(), 0, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(200),    
                    new KeyValue(node.opacityProperty(), 1, WEB_EASE),
                    new KeyValue(node.translateXProperty(), -20, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(1000),    
                    new KeyValue(node.opacityProperty(), 0, WEB_EASE),
                    new KeyValue(node.translateXProperty(), endX, WEB_EASE)
                )
            );
    super.starting();
}
项目:textmd    文件:EditorPane.java   
public void createSyncTimer(int duration) {
    covertTask = new Timeline(new KeyFrame(javafx.util.Duration.seconds(duration), (event2) -> {
        timer.start();
        String html = markdownParser.convertToHTML(editor.getText());
        webEngine.loadContent(html);
        currentHtml = html;
        covertTask.stop();
        editorToolBar.setActionText("Refreshed view successfully in " + timer.end() + "ms");
    }));
}
项目:fxexperience2    文件:CachedTimelineTransition.java   
/**
 * Create new CachedTimelineTransition
 * 
 * @param node The node that is being animated by the timeline
 * @param timeline The timeline for the animation, it should be from 0 to 1 seconds
 * @param useCache When true the node is cached as image during the animation
 */
public CachedTimelineTransition(final Node node, final Timeline timeline, final boolean useCache) {
    this.node = node;
    this.timeline = timeline;
    this.useCache = useCache;
    statusProperty().addListener((ObservableValue<? extends Status> ov, Status t, Status newStatus) -> {
        switch(newStatus) {
            case RUNNING:
                starting();
                break;
            default:
                stopping();
                break;
        }
    });
}
项目:marathonv5    文件:DataAppPreloader.java   
@Override public void handleStateChangeNotification(StateChangeNotification evt) {
    if (evt.getType() == StateChangeNotification.Type.BEFORE_INIT) {
        // check if download was crazy fast and restart progress
        if ((System.currentTimeMillis() - startDownload) < 500) {
            raceTrack.setProgress(0);
        }
        // we have finished downloading application, now we are running application
        // init() method, as we have no way of calculating real progress 
        // simplate pretend progress here
        simulatorTimeline = new Timeline();
        simulatorTimeline.getKeyFrames().add( 
                new KeyFrame(Duration.seconds(3), 
                        new KeyValue(raceTrack.progressProperty(),1)
                )
        );
        simulatorTimeline.play();
    }
}
项目:marathonv5    文件:TranslateTransitionSample.java   
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:marathonv5    文件:StrokeTransitionSample.java   
public StrokeTransitionSample() {
    super(150,150);
    Rectangle rect = new Rectangle(0, 0, 150, 150);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(null);
    rect.setStroke(Color.DODGERBLUE);
    rect.setStrokeWidth(10);
    getChildren().add(rect);

    strokeTransition = StrokeTransitionBuilder.create()
        .duration(Duration.seconds(3))
        .shape(rect)
        .fromValue(Color.RED)
        .toValue(Color.DODGERBLUE)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
项目:marathonv5    文件:FadeTransitionSample.java   
public FadeTransitionSample() {
    super(100,100);
    Rectangle rect = new Rectangle(0, 0, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.DODGERBLUE);
    getChildren().add(rect);

    fadeTransition = FadeTransitionBuilder.create()
        .duration(Duration.seconds(4))
        .node(rect)
        .fromValue(1)
        .toValue(0.2)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
项目:marathonv5    文件:TimelineSample.java   
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();

    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
项目:vars-annotation    文件:CachedTimelineTransition.java   
/**
 * Create new CachedTimelineTransition
 *
 * @param node The node that is being animated by the timeline
 * @param timeline The timeline for the animation, it should be from 0 to 1 seconds
 * @param useCache When true the node is cached as image during the animation
 */
public CachedTimelineTransition(final Node node, final Timeline timeline, final boolean useCache) {
    this.node = node;
    this.timeline = timeline;
    this.useCache = useCache;
    statusProperty().addListener(new ChangeListener<Status>() {
        @Override public void changed(ObservableValue<? extends Status> ov, Status t, Status newStatus) {
            switch(newStatus) {
                case RUNNING:
                    starting();
                    break;
                default:
                    stopping();
                    break;
            }
        }
    });
}
项目:marathonv5    文件:DataAppPreloader.java   
@Override public void start(Stage stage) throws Exception {
    preloaderStage = stage;
    preloaderStage.setScene(preloaderScene);
    preloaderStage.show();

    if (DEMO_MODE) {
        final DoubleProperty prog = new SimpleDoubleProperty(0){
            @Override protected void invalidated() {
                handleProgressNotification(new ProgressNotification(get()));
            }
        };
        Timeline t = new Timeline();
        t.getKeyFrames().add(new KeyFrame(Duration.seconds(20), new KeyValue(prog, 1)));
        t.play();
    }
}
项目:marathonv5    文件:AdvancedStockLineChartSample.java   
public AdvancedStockLineChartSample() {
    getChildren().add(createChart());
    // create timeline to add new data every 60th of second
    animation = new Timeline();
    animation.getKeyFrames().add(new KeyFrame(Duration.millis(1000/60), new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            // 6 minutes data per frame
            for(int count=0; count < 6; count++) {
                nextTime();
                plotTime();
            }
        }
    }));
    animation.setCycleCount(Animation.INDEFINITE);
}
项目:marathonv5    文件:TranslateTransitionSample.java   
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:marathonv5    文件:StrokeTransitionSample.java   
public StrokeTransitionSample() {
    super(150,150);
    Rectangle rect = new Rectangle(0, 0, 150, 150);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(null);
    rect.setStroke(Color.DODGERBLUE);
    rect.setStrokeWidth(10);
    getChildren().add(rect);

    strokeTransition = StrokeTransitionBuilder.create()
        .duration(Duration.seconds(3))
        .shape(rect)
        .fromValue(Color.RED)
        .toValue(Color.DODGERBLUE)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
项目:marathonv5    文件:RotateTransitionSample.java   
public RotateTransitionSample() {
    super(140,140);

    Rectangle rect = new Rectangle(20, 20, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.ORANGE);
    getChildren().add(rect);

    rotateTransition = RotateTransitionBuilder.create()
            .node(rect)
            .duration(Duration.seconds(4))
            .fromAngle(0)
            .toAngle(720)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:qupath-tracking-extension    文件:ExtendedViewTrackerPlayback.java   
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();
        }

    });
}
项目:marathonv5    文件:FadeTransitionSample.java   
public FadeTransitionSample() {
    super(100,100);
    Rectangle rect = new Rectangle(0, 0, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.DODGERBLUE);
    getChildren().add(rect);

    fadeTransition = FadeTransitionBuilder.create()
        .duration(Duration.seconds(4))
        .node(rect)
        .fromValue(1)
        .toValue(0.2)
        .cycleCount(Timeline.INDEFINITE)
        .autoReverse(true)
        .build();
}
项目:fxexperience2    文件:FadeOutLeftTransition.java   
/**
 * Create new FadeOutLeftTransition
 * 
 * @param node The node to affect
 */
public FadeOutLeftTransition(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));
}
项目:recruitervision    文件:FadeAnimation.java   
@Override
protected Timeline setupDismissAnimation() {
    Timeline tl = new Timeline();

    // At this stage the opacity is already at 1.0

    // Lowers the opacity to 0.0 within 2000 milliseconds
    KeyValue kv1 = new KeyValue(stage.opacityProperty(), 0.0);
    KeyFrame kf1 = new KeyFrame(Duration.millis(2000), kv1);

    tl.getKeyFrames().addAll(kf1);

    // Action to be performed when the animation has finished
    tl.setOnFinished(e -> {
        trayIsShowing = false;
        stage.close();
        stage.setLocation(stage.getBottomRight());
    });

    return tl;
}
项目:fxexperience2    文件:BounceOutUpTransition.java   
@Override protected void starting() {
    double endY = -node.localToScene(0, 0).getY() -node.getBoundsInParent().getHeight();
       timeline = new Timeline(
                new KeyFrame(Duration.millis(0),    
                    new KeyValue(node.translateYProperty(), 0, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(200),    
                    new KeyValue(node.opacityProperty(), 1, WEB_EASE),
                    new KeyValue(node.translateYProperty(), 20, WEB_EASE)
                ),
                new KeyFrame(Duration.millis(1000),    
                    new KeyValue(node.opacityProperty(), 0, WEB_EASE),
                    new KeyValue(node.translateYProperty(), endY, WEB_EASE)
                )
            );
    super.starting();
}