Java 类javafx.animation.TranslateTransitionBuilder 实例源码

项目: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    文件: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();
}
项目:kotlinfx-ensemble    文件: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();
}
项目:MasteringTables    文件:ResultView.java   
/**
 * {@inheritDoc}
 */
@Override
public void start() {
    SequentialTransitionBuilder.create()
                               .children(

                                         buildBeanAnimation(this.ratioLabel, this.ratioCircle, MTColors.RESULT_RATIO.get()),
                                         buildBeanAnimation(this.timeLabel, this.timeBean, MTColors.RESULT_TIME.get()),

                                         ParallelTransitionBuilder.create()
                                                                  .children(
                                                                            TranslateTransitionBuilder.create().node(this.monsterImage).delay(Duration.millis(500)).duration(Duration.millis(400))
                                                                                                      .byY(-766).build(),
                                                                            buildBeanAnimation(this.successLabel, this.successBean, MTColors.RESULT_SUCCESS.get()),
                                                                            FadeTransitionBuilder.create().node(this.successIcon).duration(Duration.millis(500)).fromValue(0).toValue(1).build())
                                                                  .build(),

                                         ParallelTransitionBuilder.create()
                                                                  .children(
                                                                            buildBeanAnimation(this.failureLabel, this.failureBean, MTColors.RESULT_FAILURE.get()),
                                                                            FadeTransitionBuilder.create().node(this.failureIcon).duration(Duration.millis(500)).fromValue(0).toValue(1).build())
                                                                  .build()

                               )

                               .build().playFromStart();

}
项目:javaone-shanghai-2013-javafx-presentation    文件:FinishAnimator.java   
public void handle(ActionEvent t) {
    double parentRot = slide.getParent().getParent().getRotate();
    double parentScale = slide.getParent().getParent().getScaleX(); 
    if (parentScale != PresentationController.SCALE) {
        ScaleTransitionBuilder.create()
                .node(slide.getParent().getParent())
                .toX(PresentationController.SCALE)
                .toY(PresentationController.SCALE)
                .duration(Duration.millis(600))
                .onFinished(this)
                .build().play();
    } else if (parentRot != PresentationController.getRotation(slide.getRotate())) {
        RotateTransitionBuilder.create()
                .toAngle(PresentationController.getRotation(slide.getRotate()))
                .node(slide.getParent().getParent())
                .onFinished(this)
                .duration(Duration.millis(600)).build().play();
    } else {
        Bounds point = slide.localToScene(slide.getBoundsInLocal());
        double nowX = point.getMinX();   
        double nowY = point.getMinY();
        TranslateTransitionBuilder.create()
                .node(slide.getParent().getParent())
                .byX(-nowX)
                .byY(-nowY)
                .interpolator(Interpolator.EASE_OUT)
                .duration(Duration.millis(600))
                .onFinished(new EventHandler<ActionEvent>() {

                    @Override
                    public void handle(ActionEvent arg0) {
                        slide.toFront();
                        onFinished.handle(arg0);
                    }
                })
                .build().play();
    }       

}
项目:ewidgetfx    文件:Abacus_6_Styled.java   
private Circle makeCircle(int y, int x) {
    final Circle ball = CircleBuilder.create().radius(RADIUS - 1).centerX(x).centerY(y).build();
    ball.setOnMouseClicked((MouseEvent mouseEvent) -> {
        double newX = MOVE_WAY;
        if (ball.getTranslateX() > 1) {
            newX = 0;
        }
        TranslateTransition move = TranslateTransitionBuilder.create().node(ball).toX(newX).duration(millis(200)).build();
        move.playFromStart();
    });
    return ball;
}
项目:mars-sim    文件:Scroll2.java   
@Override
public void start(Stage stage) {

  String message = 
    "Earthrise at Christmas: " +
    "[Forty] years ago this Christmas, a turbulent world " +
    "looked to the heavens for a unique view of our home "  +
    "planet. This photo of Earthrise over the lunar horizon " +
    "was taken by the Apollo 8 crew in December 1968, showing " +
    "Earth for the first time as it appears from deep space. " +
    "Astronauts Frank Borman, Jim Lovell and William Anders " +
    "had become the first humans to leave Earth orbit, " +
    "entering lunar orbit on Christmas Eve. In a historic live " +
    "broadcast that night, the crew took turns reading from " +
    "the Book of Genesis, closing with a holiday wish from " +
    "Commander Borman: \"We close with good night, good luck, " +
    "a Merry Christmas, and God bless all of you -- all of " +
    "you on the good Earth.\"";

  // Reference to the Text
  Text textRef = TextBuilder.create()
    .layoutY(100)
    .textOrigin(VPos.TOP)
    .textAlignment(TextAlignment.JUSTIFY)
    .wrappingWidth(400)
    .text(message)
    .fill(Color.rgb(187, 195, 107))
    .font(Font.font("SansSerif", FontWeight.BOLD, 24))
    .build();

   // Provides the animated scrolling behavior for the text
  TranslateTransition transTransition = TranslateTransitionBuilder.create()
    .duration(new Duration(75000))
    .node(textRef)
    .toY(-820)
    .interpolator(Interpolator.LINEAR)
    .cycleCount(Timeline.INDEFINITE)
    .build();

  Scene scene  = SceneBuilder.create()
    .width(516)
    .height(387)
    .root(
      GroupBuilder.create()
        .children(
          ImageViewBuilder.create()
            .image(new Image("http://projavafx.com/images/earthrise.jpg"))
            .build(),
          ScrollPaneBuilder.create()
            .layoutX(50)
            .layoutY(100)
            .prefWidth(440)
            .prefHeight(200)
            .hbarPolicy(ScrollBarPolicy.NEVER)
            .vbarPolicy(ScrollBarPolicy.NEVER)
            .pannable(true)
            .content(textRef)
            .style("-fx-background-color: transparent;")
            .build()
        )
        .build()
    )
    .build();

  stage.setScene(scene);
  stage.setTitle("Hello Earthrise");
  stage.show();

  // Start the text animation
  transTransition.play();
}
项目:JRebirth-Tour    文件:AbstractBaseView.java   
/**
 * TODO To complete.
 *
 * @param nextSlide the next slide
 */
private void performStepAnimation(final Node nextSlide) {

    this.subSlideTransition = ParallelTransitionBuilder.create()

                                                       .onFinished(new EventHandler<ActionEvent>() {

                                                           @Override
                                                           public void handle(final ActionEvent event) {
                                                               AbstractBaseView.this.currentSubSlide = nextSlide;
                                                           }
                                                       })

                                                       .children(
                                                                 SequentialTransitionBuilder.create()
                                                                                            .node(this.currentSubSlide)
                                                                                            .children(
                                                                                                      TranslateTransitionBuilder.create()
                                                                                                                                .duration(Duration.millis(400))
                                                                                                                                .fromY(0)
                                                                                                                                .toY(-700)
                                                                                                                                // .fromZ(-10)
                                                                                                                                .build(),
                                                                                                      TimelineBuilder.create()
                                                                                                                     .keyFrames(
                                                                                                                                new KeyFrame(Duration.millis(0),
                                                                                                                                             new KeyValue(this.currentSubSlide.visibleProperty(),
                                                                                                                                                          true)),
                                                                                                                                new KeyFrame(Duration.millis(1),
                                                                                                                                             new KeyValue(this.currentSubSlide.visibleProperty(),
                                                                                                                                                          false)))
                                                                                                                     .build())

                                                                                            .build(),
                                                                 SequentialTransitionBuilder.create()
                                                                                            .node(nextSlide)
                                                                                            .children(
                                                                                                      TimelineBuilder.create()
                                                                                                                     .keyFrames(
                                                                                                                                new KeyFrame(Duration.millis(0),
                                                                                                                                             new KeyValue(nextSlide.visibleProperty(), false)),
                                                                                                                                new KeyFrame(Duration.millis(1),
                                                                                                                                             new KeyValue(nextSlide.visibleProperty(), true)))
                                                                                                                     .build(),
                                                                                                      TranslateTransitionBuilder.create()
                                                                                                                                .duration(Duration.millis(400))
                                                                                                                                .fromY(700)
                                                                                                                                .toY(0)
                                                                                                                                // .fromZ(-10)
                                                                                                                                .build())
                                                                                            .build())
                                                       .build();
    this.subSlideTransition.play();

}
项目:JRebirth-Tour    文件:BasicView.java   
/**
 * TODO To complete.
 *
 * @param nextSlide the next slide
 */
private void performStepAnimation(final Node nextSlide) {

    this.subSlideTransition = ParallelTransitionBuilder.create()

                                                       .onFinished(new EventHandler<ActionEvent>() {

                                                           @Override
                                                           public void handle(final ActionEvent event) {
                                                               BasicView.this.currentSubSlide = nextSlide;
                                                           }
                                                       })

                                                       .children(
                                                                 SequentialTransitionBuilder.create()
                                                                                            .node(this.currentSubSlide)
                                                                                            .children(
                                                                                                      TranslateTransitionBuilder.create()
                                                                                                                                .duration(Duration.millis(400))
                                                                                                                                .fromY(model().isForwardFlow() ? 0 : 0)
                                                                                                                                .toY(model().isForwardFlow() ? -700 : 700)
                                                                                                                                // .fromZ(-10)
                                                                                                                                .build(),
                                                                                                      TimelineBuilder.create()
                                                                                                                     .keyFrames(
                                                                                                                                new KeyFrame(Duration.millis(0),
                                                                                                                                             new KeyValue(this.currentSubSlide.visibleProperty(),
                                                                                                                                                          true)),
                                                                                                                                new KeyFrame(Duration.millis(1),
                                                                                                                                             new KeyValue(this.currentSubSlide.visibleProperty(),
                                                                                                                                                          false)))
                                                                                                                     .build())

                                                                                            .build(),
                                                                 SequentialTransitionBuilder.create()
                                                                                            .node(nextSlide)
                                                                                            .children(
                                                                                                      TimelineBuilder.create()
                                                                                                                     .keyFrames(
                                                                                                                                new KeyFrame(Duration.millis(0),
                                                                                                                                             new KeyValue(nextSlide.visibleProperty(), false)),
                                                                                                                                new KeyFrame(Duration.millis(1),
                                                                                                                                             new KeyValue(nextSlide.visibleProperty(), true)))
                                                                                                                     .build(),
                                                                                                      TranslateTransitionBuilder.create()
                                                                                                                                .duration(Duration.millis(400))
                                                                                                                                .fromY(model().isForwardFlow() ? 700 : -700)
                                                                                                                                .toY(model().isForwardFlow() ? 0 : 0)
                                                                                                                                // .fromZ(-10)
                                                                                                                                .build())
                                                                                            .build())
                                                       .build();
    this.subSlideTransition.play();

}