Advertisement
Guest User

Untitled

a guest
May 25th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1.  
  2. VBox vbox = new VBox();
  3. vbox.setLayoutX(170);
  4. vbox.setLayoutY(225);
  5.  
  6. final String content = "Start the game";
  7. final Text text = new Text(10, 20, "");
  8. text.setFont(Font.font("Cambria", FontWeight.BOLD, 40));
  9.  
  10. final Animation animation = new Transition() {
  11. {
  12. setCycleDuration(Duration.millis(2000));
  13. }
  14.  
  15. protected void interpolate(double frac) {
  16. final int length = content.length();
  17. final int n = Math.round(length * (float) frac);
  18. text.setText(content.substring(0, n));
  19. }
  20. };
  21.  
  22. animation.play();
  23. final long startTime = System.currentTimeMillis();
  24.  
  25. vbox.getChildren().add(text);
  26. vbox.setSpacing(10);
  27. ((Group) scene.getRoot()).getChildren().add(vbox);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement