Java 类javafx.animation.Animation 实例源码

项目: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();
}
项目:voogasalad-ltub    文件:LoaderTester.java   
@Override
public void start(Stage primaryStage) {
    GameChooser gameManager = new GameChooser(primaryStage);        
    primaryStage.setScene(makeScene());
    primaryStage.setFullScreenExitHint("");
    primaryStage.setFullScreenExitKeyCombination(null);
    primaryStage.show();
    primaryStage.setFullScreen(true);
       Animation myAnimation = makeAnimation(myActor, 100, 200, 100);
       // start animation
       myAnimation.play();

       Animation myAnimation1 = makeAnimation(myActor1, 100, 200, 100);
       // start animation
       myAnimation1.play();

       Animation myAnimation2 = makeAnimation(myActor2,100,240,140);
       // start animation
       myAnimation2.play();
}
项目:incubator-netbeans    文件:ChartAdvancedStockLine.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    root.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    文件: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    文件:CubeSample.java   
@Override public Node create3dContent() {
    Cube c = new Cube(50,Color.RED,1);
    c.rx.setAngle(45);
    c.ry.setAngle(45);
    Cube c2 = new Cube(50,Color.GREEN,1);
    c2.setTranslateX(100);
    c2.rx.setAngle(45);
    c2.ry.setAngle(45);
    Cube c3 = new Cube(50,Color.ORANGE,1);
    c3.setTranslateX(-100);
    c3.rx.setAngle(45);
    c3.ry.setAngle(45);

    animation = new Timeline();
    animation.getKeyFrames().addAll(
            new KeyFrame(Duration.ZERO,
                    new KeyValue(c.ry.angleProperty(), 0d),
                    new KeyValue(c2.rx.angleProperty(), 0d),
                    new KeyValue(c3.rz.angleProperty(), 0d)
            ),
            new KeyFrame(Duration.seconds(1),
                    new KeyValue(c.ry.angleProperty(), 360d),
                    new KeyValue(c2.rx.angleProperty(), 360d),
                    new KeyValue(c3.rz.angleProperty(), 360d)
            ));
    animation.setCycleCount(Animation.INDEFINITE);

    return new Group(c,c2,c3);
}
项目:GameAuthoringEnvironment    文件:GameEngine.java   
private void initializeTimeline () {
    Timeline timeline = getTimeline();
    Duration frameDuration = Duration.seconds(1.0d / FPS);
    KeyFrame repeatedFrame = new KeyFrame(frameDuration, e -> step(frameDuration));
    timeline.getKeyFrames().add(repeatedFrame);
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
项目:The-Trail    文件:TravelController.java   
@FXML
public void initialize(){

    Main.checkFullScreen();

    Main.getAlertWindow().setOnCloseRequest(e -> spriteImage.setImage(new Image(Gang.getCarSpriteURL())));

    // updating labels
    distanceLabel.setText("To go: "+ Gang.getDistance() +"Mi");
    conditionsLabel.setText("Condition: "+ Gang.getHealthConditions());
    daysLabel.setText("Days: "+ Gang.getDays());
    statusLabel.setText("Status: Resting");

    // setting up how the animation will work
    drivingTransition = new TranslateTransition();
    drivingTransition.setDuration(Duration.seconds(animationDuration));
    drivingTransition.setToX(Main.getMainWindow().getWidth() - 850);
    drivingTransition.setNode(sprite);
    drivingTransition.setCycleCount(Animation.INDEFINITE);

    // fixes the bug with thread not ending when stage was closed
    Main.getMainWindow().setOnCloseRequest(e -> Gang.setMoving(false));
}
项目:The-Trail    文件:TravelController.java   
@FXML
private void updateGUI(){

    spriteImage.setImage(new Image(Gang.getCarSpriteURL()));

    // updating drivingTransition
    drivingTransition = new TranslateTransition();
    drivingTransition.setDuration(Duration.seconds(animationDuration));
    drivingTransition.setToX((Main.getMainWindow().getWidth() / -1) - 400);
    drivingTransition.setNode(sprite);
    drivingTransition.setCycleCount(Animation.INDEFINITE);

    // updating labels
    distanceLabel.setText("To go: "+ Gang.getDistance() +"Mi");
    conditionsLabel.setText("Condition: "+ Gang.getHealthConditions());
    daysLabel.setText("Days: "+ Gang.getDays());
    statusLabel.setText("Status: Resting");
}
项目:MultiAxisCharts    文件:MultiAxisBarChart.java   
@Override
void seriesBeingRemovedIsAdded(Series<X, Y> series) {
    boolean lastSeries = (pt.getChildren().size() == 1) ? true : false;
    if (pt != null) {
        if (!pt.getChildren().isEmpty()) {
            for (Animation a : pt.getChildren()) {
                a.setOnFinished(null);
            }
        }
        for (Data<X, Y> item : series.getData()) {
            processDataRemove(series, item);
            if (!lastSeries) {
                restoreDataValues(item);
            }
        }
        XYValueMap.clear();
        pt.setOnFinished(null);
        pt.getChildren().clear();
        pt.stop();
        removeSeriesFromDisplay(series);
    }
}
项目:gatepass    文件:MainWindow.java   
public void rotateHer(Label labelHer, ImageView iv)
{
    RotateTransition rotation = new RotateTransition(Duration.seconds(2), iv);
    rotation.setCycleCount(Animation.INDEFINITE);
    rotation.setByAngle(360);

    iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
    iv.setRotationAxis(Rotate.Y_AXIS);

    labelHer.setOnMouseEntered(e ->
    { 
        rotation.play();
        iv.setRotate(180);
    });
    labelHer.setOnMouseExited(e ->
    { 
        rotation.pause();
        iv.setRotate(0);
    });
}
项目:gatepass    文件:ExDetails.java   
public void rotateHer(Label labelHer, ImageView iv)
{
    RotateTransition rotation = new RotateTransition(Duration.seconds(2), iv);
    rotation.setCycleCount(Animation.INDEFINITE);
    rotation.setByAngle(360);

    iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
    iv.setRotationAxis(Rotate.Y_AXIS);

    labelHer.setOnMouseEntered(e ->
    { 
        rotation.play();
        iv.setRotate(180);
    });
    labelHer.setOnMouseExited(e ->
    { 
        rotation.pause();
        iv.setRotate(0);
    });
}
项目:gatepass    文件:SysSettings.java   
public void rotateHer(Label labelHer, ImageView iv)
{
    RotateTransition rotation = new RotateTransition(Duration.seconds(2.3), iv);
    rotation.setCycleCount(Animation.INDEFINITE);
    rotation.setByAngle(360);

    iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
    iv.setRotationAxis(Rotate.Y_AXIS);

    labelHer.setOnMouseEntered(e ->
    { 
        rotation.play();
        iv.setRotate(180);
    });
    labelHer.setOnMouseExited(e ->
    { 
        rotation.pause();
        iv.setRotate(0);
    });
}
项目:Drones-Simulator    文件:SpriteAnimation.java   
/**
 * Creates an animation that will run for indefinite time.
 * Use setCycleCount(1) to run animation only once. Remember to remove the imageView afterwards.
 *
 * @param imageView - the imageview of the sprite
 * @param duration - How long should one animation cycle take
 * @param count - Number of frames
 * @param columns - Number of colums the sprite has
 * @param offsetX - Offset x
 * @param offsetY - Offset y
 * @param width - Width of each frame
 * @param height - Height of each frame
 */
public SpriteAnimation(
        ImageView imageView,
        Duration duration,
        int count, int columns,
        int offsetX, int offsetY,
        int width, int height
) {
    this.imageView = imageView;
    this.count = count;
    this.columns = columns;
    this.offsetX = offsetX;
    this.offsetY = offsetY;
    this.width = width;
    this.height = height;
    setCycleDuration(duration);
    setCycleCount(Animation.INDEFINITE);
    setInterpolator(Interpolator.LINEAR);
    this.imageView.setViewport(new Rectangle2D(offsetX, offsetY, width, height));

}
项目:BatpackJava    文件:SplashScreenController.java   
private void showLoading() {
    final KeyFrame oneFrame = new KeyFrame(Duration.millis(750), (ActionEvent evt) -> {
           loading.setText(getNextLoadingText());
           //bms.setText(getNextBmsText());
    });
    Timeline timer = TimelineBuilder.create().cycleCount(Animation.INDEFINITE).keyFrames(oneFrame).build();
    timer.playFromStart();
}
项目:ABC-List    文件:SignFlowPane.java   
private void onActionScaleToExpandedMode() {
    LoggerFacade.getDefault().trace(this.getClass(), "On action scale to expanded mode"); // NOI18N

    if (
            scaleTransition != null
            && scaleTransition.getStatus().equals(Animation.Status.RUNNING)
    ) {
        scaleTransition.stop();
    }

    scaleTransition.setFromX(this.getScaleX());
    scaleTransition.setFromY(this.getScaleY());
    scaleTransition.setToX(1.015d);
    scaleTransition.setToY(1.01d);

    scaleTransition.playFromStart();
}
项目:ABC-List    文件:SignFlowPane.java   
private void onActionScaleToNormalMode() {
    LoggerFacade.getDefault().trace(this.getClass(), "On action scale to normal mode"); // NOI18N

    if (
            scaleTransition != null
            && scaleTransition.getStatus().equals(Animation.Status.RUNNING)
    ) {
        scaleTransition.stop();
    }

    scaleTransition.setFromX(this.getScaleX());
    scaleTransition.setFromY(this.getScaleY());
    scaleTransition.setToX(1.0d);
    scaleTransition.setToY(1.0d);

    scaleTransition.playFromStart();
}
项目:qupath-tracking-extension    文件:ExtendedViewTrackerPlayback.java   
private boolean doStartPlayback() {
    if (TrackerPaintStage.getTracker().isEmpty()) {
        return false;
    } else {
        this.startTimestamp = System.currentTimeMillis();
        if(this.timeline.getStatus() == Animation.Status.RUNNING) {
            this.timeline.playFromStart();
        } else {
            this.timeline.play();
        }

        this.playing.set(true);
        viewer.addOverlay(playbackOverlay);
        return true;
    }
}
项目:voogasalad-ltub    文件:AnimationImage.java   
public ImageView getImageView(int seed) {
    final ImageView imageView = new ImageView();

    int[] numberList = new int[6];
    for(int i = 0; i < NUMBER_OF_IMAGE; i++){
        numberList[i] = i;
    }
    shuffleArray(seed, numberList);
    List<Image> list = new ArrayList<>();

    for(int j =0; j < NUMBER_OF_IMAGE; j++){
        list.add(getImage(numberList[j]));
    }

    final Animation animation = new ImageAnimation(list, imageView, Duration.millis(5000), WIDTH, HEIGHT);
    animation.setCycleCount(Animation.INDEFINITE);
    animation.play();
    return imageView;
}
项目:fx-animation-editor    文件:PlayerHandler.java   
private void onPlayModeChanged(boolean playMode) {
    if (!playMode) {
        selectionOnPlayStart.forEach(n -> n.setSelected(true));
        selectionOnPlayStart.clear();
        timeline.stop();
        timeline.getKeyFrames().clear();
        playerModel.currentTimeProperty().unbind();
        timelineModel.setSelectedKeyFrame(selectedKeyFrameOnPlayStart);
    } else {
        selectionOnPlayStart.clear();
        selectionOnPlayStart.addAll(sceneModel.getSelectedNodes().collect(Collectors.toSet()));
        sceneModel.getNodes().forEach(n -> n.setSelected(false));
        selectedKeyFrameOnPlayStart = timelineModel.getSelectedKeyFrame();
        timelineModel.setSelectedKeyFrame(null);
        playerModel.currentTimeProperty().bind(currentTimeInSeconds());
        timeline.getKeyFrames().addAll(timelineModel.getKeyFrames().stream().map(this::createKeyFrame).collect(Collectors.toList()));
        timeline.setCycleCount(Animation.INDEFINITE);
        timeline.playFromStart();
    }
}
项目:CapsLock    文件:MainFormController.java   
@Override
public void initialize(URL url, ResourceBundle rb){
    ImageTimeLine = new Timeline(new KeyFrame(
    Duration.millis(2500),
    ae -> UpdateImage(ae)));
    ImageTimeLine.setCycleCount(Animation.INDEFINITE);//タイマーを無限ループさせる.
}
项目:Hostel-Management-System    文件:MainProgramSceneController.java   
@FXML
private void shirnkDetailsAction(ActionEvent event)
{
    if ("Cancel".equals(StudentDetailController.editCancelButton.getText()))
    {
        StudentDetailController.editCancelButtonAction(event);
    }

    final Animation animation = new Transition()
    {

        {
            setCycleDuration(Duration.millis(800));
        }

        @Override
        protected void interpolate(double frac)
        {
            SplitPaneMain.setDividerPosition(0, SplitPaneMain.getDividerPositions()[0]-frac);
        }
    };
    animation.play();
}
项目:FxEditor    文件:StyledTextPane.java   
public StyledTextPane()
{
    textField = new CTextFlow();

    caret = new Path();
    FX.style(caret, CARET);
    caret.setManaged(false);
    caret.setStroke(Color.BLACK);

    getChildren().add(textField);

    caretTimeline = new Timeline();
    caretTimeline.setCycleCount(Animation.INDEFINITE);
    // TODO property
    updateBlinkRate(Duration.millis(500));

    // FIX allow custom handlers
    new StyledTextPaneMouseController(this);
}
项目:ics4u    文件:Game.java   
public void start(Stage primaryStage) {
    primaryStage.setTitle("The Horse in Motion");

    final ImageView imageView = new ImageView(IMAGE);
    imageView.setViewport(new Rectangle2D(OFFSET_X, OFFSET_Y, WIDTH, HEIGHT));

    final Animation animation = new SpriteAnimation(
        imageView,
        Duration.millis(1000),
        COUNT, COLUMNS,
        OFFSET_X, OFFSET_Y,
        WIDTH, HEIGHT
    );
    animation.setCycleCount(Animation.INDEFINITE);
    animation.play();

    primaryStage.setScene(new Scene(new Group(imageView)));
    primaryStage.show();
}
项目:Incubator    文件:ApplicationPresenter.java   
public void onActionMouseEntered() {
    LoggerFacade.INSTANCE.debug(this.getClass(), "On action MouseEntered"); // NOI18N

    if (ftMenuShowOrHideIt.getStatus().equals(Animation.Status.RUNNING)) {
        ftMenuShowOrHideIt.stop();
        currentMenuOpacity = bMenu.getOpacity();
    }

    bMenu.setManaged(Boolean.TRUE);
    ftMenuShowOrHideIt.setFromValue(currentMenuOpacity);
    ftMenuShowOrHideIt.setToValue(1.0d);
    ftMenuShowOrHideIt.setOnFinished((ActionEvent event) -> {
        currentMenuOpacity = bMenu.getOpacity();
    });

    ftMenuShowOrHideIt.playFromStart();
}
项目:Incubator    文件:ApplicationPresenter.java   
public void onActionMouseExited() {
    LoggerFacade.INSTANCE.debug(this.getClass(), "On action MouseExited"); // NOI18N

    if (ftMenuShowOrHideIt.getStatus().equals(Animation.Status.RUNNING)) {
        ftMenuShowOrHideIt.stop();
        currentMenuOpacity = bMenu.getOpacity();
    }

    ftMenuShowOrHideIt.setFromValue(currentMenuOpacity);
    ftMenuShowOrHideIt.setToValue(0.0d);
    ftMenuShowOrHideIt.setOnFinished((ActionEvent event) -> {
        currentMenuOpacity = bMenu.getOpacity();
        bMenu.setManaged(Boolean.FALSE);
    });

    ftMenuShowOrHideIt.playFromStart();
}
项目:FXGLGames    文件:GameController.java   
private Animation getAnimationLoseLife(Texture texture) {
    texture.setFitWidth(64);
    texture.setFitHeight(64);

    Viewport viewport = gameScene.getViewport();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.66), texture);
    tt.setToX(viewport.getWidth() / 2 - texture.getFitWidth() / 2);
    tt.setToY(viewport.getHeight() / 2 - texture.getFitHeight() / 2);

    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), texture);
    st.setToX(0);
    st.setToY(0);

    return new SequentialTransition(tt, st);
}
项目:SokubanFX    文件:PreviewPresenter.java   
private void onActionManagedMapPlayer() {
    LoggerFacade.INSTANCE.debug(this.getClass(), "On action managed Map player"); // NOI18N

    if (ptShowNextRandomMap == null) {
        return;
    }

    if (ptShowNextRandomMap.getStatus().equals(Animation.Status.RUNNING)) {
        ptShowNextRandomMap.pause();
        return;
    }

    if (ptShowNextRandomMap.getStatus().equals(Animation.Status.PAUSED)) {
        ptShowNextRandomMap.play();
    }
}
项目:photometric-data-retriever    文件:SearchOverviewController.java   
@FXML
private void initialize() {
    app.getPrimaryStage().getScene().setOnKeyPressed(event -> {
        if (event.getCode().equals(KeyCode.ESCAPE)) {
            cancelSearch();
        }
    });
    shaker = new Shaker(mainPane);
    initializeServices();
    initializeFields();
    initializeQueryParser();


    int columns = 15;
    int count = 120;
    imageAnimation = new SpriteAnimation(
            image,
            Duration.millis(10000),
            count, columns,
            0, 0,
            256, 256
    );

    imageAnimation.setCycleCount(Animation.INDEFINITE);
}
项目:ReqTraq    文件:StyledTextPane.java   
public StyledTextPane()
{
    textField = new CTextFlow();

    caret = new Path();
    FX.style(caret, CARET);
    caret.setManaged(false);
    caret.setStroke(Color.BLACK);

    getChildren().add(textField);

    caretTimeline = new Timeline();
    caretTimeline.setCycleCount(Animation.INDEFINITE);
    // TODO property
    updateBlinkRate(Duration.millis(500));

    // FIX allow custom handlers
    new StyledTextPaneMouseController(this);
}
项目:enders_game    文件:Puzzle.java   
/**
 * Animates the bullet to follow the path taken
 * @param tileSize
 */
private void animateBullet() {
    int tileSize = tileWidthsList.get(level - 1);
    timeline = new Timeline(new KeyFrame(Duration.millis(Settings.PUZZLE_BULLET_SPEED), e -> {
        if(bulletIndex < pathTaken.size()) {
            TranslateTransition tt = new TranslateTransition(Duration.millis(Settings.PUZZLE_BULLET_SPEED), bulletNode);
            tt.setToX(tileSize/2 + pathTaken.get(bulletIndex)[1]*tileSize);
            tt.setToY(tileSize/2 + pathTaken.get(bulletIndex)[0]*tileSize);
            tt.setCycleCount(1);
            tt.play();
            bulletIndex++;
        }
        handleLevelCompletion();
    }));
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
项目:helloiot    文件:Clock.java   
public void play() {
    if (timeline != null) {
        stop();
    }

    datetime = LocalDateTime.now();
    int second = datetime.getSecond();
    datetime.minusSeconds(second);
    l.setText(datetime.format(formatter));

    timeline = new Timeline(new KeyFrame(Duration.minutes(1.0), ae -> {
        datetime = datetime.plusMinutes(1);
        l.setText(datetime.format(formatter));
    }));
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.playFrom(Duration.seconds(second));
}
项目:Tuntuni    文件:MessageBox.java   
public void initialize(Message message) {
    mMessage = message;

    if (mMessage.isReceived()) {
        setId("message-receiver");
    } else {
        setId("message-sender");
    }

    double width = senderImage.getFitWidth();
    double height = senderImage.getFitHeight();
    Image avatar = mMessage.getSender().getAvatar(width, height);
    if (avatar != null) {
        senderImage.setImage(avatar);
    }

    mDate = mMessage.getTime();
    messageBody.setText(mMessage.getText());

    mTimeline.setCycleCount(Animation.INDEFINITE);
    mTimeline.play();

}
项目:grapheditor    文件:AutoScrollingWindow.java   
/**
 * Starts the auto-scrolling.
 */
private void startScrolling() {

    isScrolling = true;
    jumpsTaken = 0;

    final KeyFrame frame = new KeyFrame(Duration.millis(parameters.getJumpPeriod()), event -> {
        if (dragEventTarget != null && isScrolling && jumpDistance != null) {
            panBy(jumpDistance.getX(), jumpDistance.getY());
            dragEventTarget.fireEvent(currentDragEvent);
            jumpsTaken++;
        }
    });

    timeline = new Timeline();
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.getKeyFrames().add(frame);
    timeline.play();
}
项目:gluon-samples    文件:RubikView.java   
public RubikView(String name) {
    super(name);

    rubik = new Rubik();
    setCenter(rubik.getSubScene());

    timer = new Timeline(
        new KeyFrame(Duration.ZERO, 
            e -> clock.set(LocalTime.now().minusNanos(time.toNanoOfDay()).format(fmt))),
        new KeyFrame(Duration.seconds(1)));

    timer.setCycleCount(Animation.INDEFINITE);
    timeLabel = new Label();
    timeLabel.setStyle("-fx-text-fill: white; -fx-font-size: 0.9em;");
    timeLabel.textProperty().bind(clock);

    rubik.isSolved().addListener((ov,b,b1)->{
        if(b1){
            timer.stop();
            MobileApplication.getInstance().showMessage("Solved in " + (rubik.getCount().get() + 1) + " movements!");
        }
    });

    getStylesheets().add(RubikView.class.getResource("rubik.css").toExternalForm());
    addEventHandler(MouseEvent.ANY, rubik.eventHandler);
}
项目:example_javafx    文件:Main.java   
/**
 * Set things up at the beginning.
 */
@Override
public void start (Stage s) {
    s.setTitle("Big BallWorld!");
    // create your own game here
    myGame = new BallWorld();
    // attach game to the stage and display it
    Scene scene = myGame.init(s, 800, 800);
    s.setScene(scene);
    s.show();

    // setup the game's loop
    KeyFrame frame = myGame.start(NUM_FRAMES_PER_SECOND + 5);
    Timeline animation = new Timeline();
    animation.setCycleCount(Animation.INDEFINITE);
    animation.getKeyFrames().add(frame);
    animation.play();
}
项目:mars-sim    文件:Flyout.java   
/**
 * The "do once" configuration
 */
private void defineFlyout() {
    tl.setCycleCount(1);
    loc.addListener((obs, oldY, newY) -> {
        if(flyoutSide == Side.TOP || flyoutSide == Side.TOP_RIGHT 
                || flyoutSide == Side.BOTTOM || flyoutSide == Side.BOTTOM_LEFT) {
            userNodeContainer.setLayoutY(newY.doubleValue());
        }else{
            userNodeContainer.setLayoutX(newY.doubleValue());
        }

    });
    tl.statusProperty().addListener((v, o, n) -> {
        if(n == Animation.Status.STOPPED) {
            if(!flyoutShowing) {
                popup.hide();
            } 
            flyOutStatus.setValue(Flyout.Status.COMPLETE);
        }else{
            flyOutStatus.setValue(Flyout.Status.RUNNING);
        }
    });
}
项目:mars-sim    文件:AnimatedTableRow.java   
private void moveDataWithAnimation(final TableView<Person> sourceTable,
        final TableView<Person> destinationTable,
        final Pane commonTableAncestor, final TableRow<Person> row) {
    // Create imageview to display snapshot of row:
    final ImageView imageView = createImageView(row);
    // Start animation at current row:
    final Point2D animationStartPoint = row.localToScene(new Point2D(0, 0)); // relative to Scene
    final Point2D animationEndPoint = computeAnimationEndPoint(destinationTable); // relative to Scene
    // Set start location
    final Point2D startInRoot = commonTableAncestor.sceneToLocal(animationStartPoint); // relative to commonTableAncestor
    imageView.relocate(startInRoot.getX(), startInRoot.getY());
    // Create animation
    final Animation transition = createAndConfigureAnimation(
            sourceTable, destinationTable, commonTableAncestor, row,
            imageView, animationStartPoint, animationEndPoint);
    // add animated image to display
    commonTableAncestor.getChildren().add(imageView);
    // start animation
    transition.play();
}
项目:arcgis-runtime-samples-java    文件:CalculateDistance3dController.java   
/**
 * Sets graphic animation to keep running every 100 milliseconds.
 * <p>
 * The animation will play once the view is done loading.
 */
private void setupAnimation() {

  animation = new Timeline(new KeyFrame(Duration.millis(100), e -> animate()));
  animation.setCycleCount(Animation.INDEFINITE);

  // listener for the view to stop loading
  DrawStatusChangedListener listener = new DrawStatusChangedListener() {

    @Override
    public void drawStatusChanged(DrawStatusChangedEvent drawStatusChangedEvent) {
      if (drawStatusChangedEvent.getDrawStatus() == DrawStatus.COMPLETED) {
        // start animation
        animation.play();
        // stop listening for the view to load
        sceneView.removeDrawStatusChangedListener(this);
      }
    }
  };
  sceneView.addDrawStatusChangedListener(listener);
}
项目:FXGLGames    文件:GameController.java   
private Animation getAnimationLoseLife(Texture texture) {
    texture.setFitWidth(64);
    texture.setFitHeight(64);

    Viewport viewport = gameScene.getViewport();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.66), texture);
    tt.setToX(viewport.getWidth() / 2 - texture.getFitWidth() / 2);
    tt.setToY(viewport.getHeight() / 2 - texture.getFitHeight() / 2);

    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), texture);
    st.setToX(0);
    st.setToY(0);

    return new SequentialTransition(tt, st);
}
项目:training    文件:SpriteView.java   
public void moveTo(Main.Location loc) {
    walking = new Timeline(Animation.INDEFINITE,
        new KeyFrame(Duration.seconds(.001), new KeyValue(direction, location.getValue().directionTo(loc))),
        new KeyFrame(Duration.seconds(.002), new KeyValue(location, loc)),
        new KeyFrame(Duration.seconds(1), new KeyValue(translateXProperty(), loc.getX() * Main.CELL_SIZE)),
        new KeyFrame(Duration.seconds(1), new KeyValue(translateYProperty(), loc.getY() * Main.CELL_SIZE)),
        new KeyFrame(Duration.seconds(.25), new KeyValue(frame, 0)),
        new KeyFrame(Duration.seconds(.5), new KeyValue(frame, 1)),
        new KeyFrame(Duration.seconds(.75), new KeyValue(frame, 2)),
        new KeyFrame(Duration.seconds(1), new KeyValue(frame, 1))
    );
    walking.setOnFinished(e -> {
        if (arrivalHandler != null) {
            arrivalHandler.handle(e);
        }
    });
    Application.invokeLater(walking::play);
}