Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8115024

Animation. Cycles are not equivalent in SequentialTransition

XMLWordPrintable

      //first cycle of animation is different with other cycles.
      //r2 stays right after first cycle
      public class Bug extends Application {

          @Override
          public void start(Stage primaryStage) {
              final SequentialTransition all = new SequentialTransition();
              
              Rectangle r1 = new Rectangle(50, 50, Color.RED);
              Rectangle r2 = new Rectangle(50, 50, Color.BLUE);
              
              StackPane root = new StackPane();
              root.getChildren().add(r1);
              root.getChildren().add(r2);

              TranslateTransition r1A = TranslateTransitionBuilder.create().node(r1).fromX(0).toX(150).duration(Duration.seconds(5)).build();
              TranslateTransition r2A = TranslateTransitionBuilder.create().node(r2).fromX(0).toX(150).duration(Duration.seconds(5)).build();
              all.getChildren().addAll(r1A, r2A);
              all.setCycleCount(3);
              all.play();

              Scene scene = new Scene(root, 500, 250);

              primaryStage.setTitle("Hello World!");
              primaryStage.setScene(scene);
              primaryStage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }
      }

            msladecek Martin Sládeček
            anazarov Andrey Nazarov (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: