/*     */ public Object animate(Animation paramAnimation) /*     */ {
   /* 108 */ SequentialTransition localSequentialTransition = new SequentialTransition();
   /* 109 */ localSequentialTransition.getChildren().add(paramAnimation);
   /* 110 */ localSequentialTransition.setOnFinished(this);
   /*     */
   /* 112 */ if (this.activeTimeLines.isEmpty()) start();
   /*     */
   /* 114 */ this.activeTimeLines.put(localSequentialTransition, localSequentialTransition);
   /*     */
   /* 116 */ localSequentialTransition.play();
   /* 117 */ return localSequentialTransition;
   /*     */ }
예제 #2
0
 public void readyToGoAnimation() {
   // Sync progress bar slides out ...
   TranslateTransition leave = new TranslateTransition(Duration.millis(600), syncBox);
   leave.setByY(80.0);
   // Buttons slide in and clickable address appears simultaneously.
   TranslateTransition arrive = new TranslateTransition(Duration.millis(600), controlsBox);
   arrive.setToY(0.0);
   FadeTransition reveal = new FadeTransition(Duration.millis(500), addressControl);
   reveal.setToValue(1.0);
   ParallelTransition group = new ParallelTransition(arrive, reveal);
   // Slide out happens then slide in/fade happens.
   SequentialTransition both = new SequentialTransition(leave, group);
   both.setCycleCount(1);
   both.setInterpolator(Interpolator.EASE_BOTH);
   both.play();
 }
  private SequentialTransition createTransition(
      final Point2D pntStartPoint, final Point2D pntEndPoint, ImageView imView) {

    imView =
        new ImageView(
            new Image(getClass().getResourceAsStream("/res/img/b1fh.png"), 75, 75, true, true));

    imView.setX(pntStartPoint.getX());
    imView.setY(pntStartPoint.getY() - 30);

    APMainScreen.getChildren().add(imView);

    TranslateTransition translateTransition = new TranslateTransition(Duration.millis(300), imView);
    translateTransition.setFromX(0);
    translateTransition.setToX(pntEndPoint.getX() - pntStartPoint.getX());
    translateTransition.setFromY(0);
    translateTransition.setToY(pntEndPoint.getY() - pntStartPoint.getY());

    translateTransition.setCycleCount(1);
    translateTransition.setAutoReverse(false);

    int rnd = randInt(1, 3);

    RotateTransition rotateTransition = new RotateTransition(Duration.millis(150), imView);
    rotateTransition.setByAngle(90F);
    rotateTransition.setCycleCount(rnd);
    rotateTransition.setAutoReverse(false);

    ParallelTransition parallelTransition = new ParallelTransition();
    parallelTransition.getChildren().addAll(translateTransition, rotateTransition);

    SequentialTransition seqTrans = new SequentialTransition();
    seqTrans.getChildren().addAll(parallelTransition);

    final ImageView ivRemove = imView;
    seqTrans.setOnFinished(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent arg0) {
            APMainScreen.getChildren().remove(ivRemove);
          }
        });

    return seqTrans;
  }
 protected void addAnimation(Transition transition, Animation child) {
   if (transition instanceof SequentialTransition) {
     ((SequentialTransition) transition).getChildren().add(child);
   } else if (transition instanceof ParallelTransition) {
     ((ParallelTransition) transition).getChildren().add(child);
   } else {
     throw new IllegalArgumentException(
         "Main transition must be either a Parallel or Sequential Transition");
   }
 }
예제 #5
0
    private void snapshotTweet(final Parent tweetContainer) throws InterruptedException {
      final CountDownLatch latch = new CountDownLatch(1);
      // render the chart in an offscreen scene (scene is used to allow css processing) and snapshot
      // it to an image.
      // the snapshot is done in runlater as it must occur on the javafx application thread.
      Platform.runLater(
          () -> {
            // animation
            obsFadeOutWords.stream().forEach(w -> parallelWords.getChildren().add(fadeOut(w)));
            obsFadeInWords.stream().forEach(w -> parallelTexts.getChildren().add(fadeIn(w)));

            sequential.setOnFinished(
                e -> {
                  parallelWords.getChildren().clear();
                  parallelTexts.getChildren().clear();
                  latch.countDown();
                });

            sequential.play();
          });

      latch.await();
    }
  private SequentialTransition CalculateTransition(
      Card c, HBox PlayerCardBox, ImageView imView, int iCardDrawn) {
    // This is the card that is going to be dealt to the player.
    String strCard = "/res/img/" + c.getCardImg();
    ImageView imgvCardDealt =
        new ImageView(new Image(getClass().getResourceAsStream(strCard), 96, 71, true, true));

    // imgvCardFaceDown - There's already a place holder card
    // sitting in
    // the player's hbox. It's face down. Find it
    // and then determine it's bounds and top left hand handle.
    ImageView imgvCardFaceDown = (ImageView) PlayerCardBox.getChildren().get(iCardDrawn - 1);
    Bounds bndCardDealt = imgvCardFaceDown.localToScene(imgvCardFaceDown.getBoundsInLocal());
    Point2D pntCardDealt = new Point2D(bndCardDealt.getMinX(), bndCardDealt.getMinY());

    // imgvDealerDeck = the card in the common area, where dealer's
    // card
    // is located. Find the boundary top left point.
    ImageView imgvDealerDeck = (ImageView) HboxCommonArea.getChildren().get(0);
    Bounds bndCardDeck = imgvDealerDeck.localToScene(imgvDealerDeck.getBoundsInLocal());
    Point2D pntCardDeck = new Point2D(bndCardDeck.getMinX(), bndCardDeck.getMinY());

    // Add a sequential transition to the card (move, rotate)
    SequentialTransition transMoveRotCard = createTransition(pntCardDeck, pntCardDealt, imView);

    // Add a parallel transition to the card (fade in/fade out).
    final ParallelTransition transFadeCardInOut =
        createFadeTransition(
            imgvCardFaceDown,
            new Image(getClass().getResourceAsStream(strCard), 75, 75, true, true));

    SequentialTransition transAllActions = new SequentialTransition();
    transAllActions.getChildren().addAll(transMoveRotCard, transFadeCardInOut);

    return transAllActions;
  }
예제 #7
0
 public LiveScatterChartApp() {
   // create animation
   Timeline timeline1 = new Timeline();
   timeline1
       .getKeyFrames()
       .add(
           new KeyFrame(
               Duration.millis(20),
               (ActionEvent actionEvent) -> {
                 series
                     .getData()
                     .add(
                         new XYChart.Data<Number, Number>(
                             nextX, Math.sin(Math.toRadians(nextX)) * 100));
                 nextX += 10;
               }));
   timeline1.setCycleCount(200);
   Timeline timeline2 = new Timeline();
   timeline2
       .getKeyFrames()
       .add(
           new KeyFrame(
               Duration.millis(50),
               (ActionEvent actionEvent) -> {
                 series
                     .getData()
                     .add(
                         new XYChart.Data<Number, Number>(
                             nextX, Math.sin(Math.toRadians(nextX)) * 100));
                 if (series.getData().size() > 54) {
                   series.getData().remove(0);
                 }
                 nextX += 10;
               }));
   timeline2.setCycleCount(Animation.INDEFINITE);
   animation = new SequentialTransition();
   animation.getChildren().addAll(timeline1, timeline2);
 }
  @FXML
  private void handleDraw() {

    if (this.mainApp.getiGameType() == null) {
      displayWarning("you must select a game to play from the menu");
      return;
    }

    iCardDrawn++;
    iDrawCount++;
    ImageView imView = null;
    eGameState = eGameState.PlayOfGame;

    // Disable the button in case of double-click
    SetGameControls(eGameState.DrawingCard);

    // Create the parent transition
    SequentialTransition tranDealCards = new SequentialTransition();

    // Figure the action based on the game, state of game
    Action act = new Action(gme, iCardDrawnPlayer, iCardDrawnCommon, iDrawCount);

    if (act.geteDrawAction() == eDrawAction.DrawPlayer) {
      // Draw a card for each player seated
      for (int iDraw = 0; iDraw < act.getiCardDrawn(); iDraw++) {
        iCardDrawnPlayer++;
        for (Player p : mainApp.GetSeatedPlayers()) {
          Card c = gme.getGameDeck().drawFromDeck();

          HBox PlayerCardBox = null;

          switch (p.getiPlayerPosition()) {
            case 1:
              PlayerCardBox = hBoxP1Cards;
              imView = imgTransCardP1;
              break;
            case 2:
              PlayerCardBox = hBoxP2Cards;
              imView = imgTransCardP2;
              break;

            case 3:
              PlayerCardBox = hBoxP3Cards;
              imView = imgTransCardP3;
              break;

            case 4:
              PlayerCardBox = hBoxP4Cards;
              imView = imgTransCardP4;
              break;
          }
          gme.FindPlayerGame(gme, p).addCardToHand(c);
          tranDealCards
              .getChildren()
              .add(CalculateTransition(c, PlayerCardBox, imView, iCardDrawnPlayer));
        }
      }

    } else if (act.geteDrawAction() == eDrawAction.DrawCommon) {

      for (int iDraw = 0; iDraw < act.getiCardDrawn(); iDraw++) {
        iCardDrawnCommon++;
        imView = imgTransCardCommon;
        Card c = gme.getGameDeck().drawFromDeck();
        gme.FindCommonHand(gme).addCardToHand(c);
        tranDealCards
            .getChildren()
            .add(CalculateTransition(c, HboxCommunityCards, imView, iCardDrawnCommon));
      }
    }

    // tranDealCards is the master transition... it has deals for every card
    // to every player. Play it.
    tranDealCards.play();

    // If bEvalHand is true, it's time to evaluate the Hand...
    if (act.isbEvaluateHand()) {

      ArrayList<GamePlayPlayerHand> AllPlayersHands = new ArrayList<GamePlayPlayerHand>();
      ArrayList<Hand> BestPlayerHands = new ArrayList<Hand>();
      HashMap hsPlayerHand = new HashMap();

      for (Player p : mainApp.GetSeatedPlayers()) {
        GamePlayPlayerHand GPPH = gme.FindPlayerGame(gme, p);
        Hand PlayerHand = GPPH.getHand();
        GamePlayPlayerHand GPCH = gme.FindCommonHand(gme);

        ArrayList<Hand> AllHands = Hand.ListHands(GPPH.getHand(), GPCH.getHand(), GPPH.getGame());
        Hand hBestHand = Hand.PickBestHand(AllHands);
        GPPH.setBestHand(hBestHand);
        hsPlayerHand.put(hBestHand, GPPH.getPlayer());
        BestPlayerHands.add(hBestHand);
      }

      Hand WinningHand = Hand.PickBestHand(BestPlayerHands);
      Player WinningPlayer = (Player) hsPlayerHand.get(WinningHand);
      System.out.println(
          "Winning Player Position: "
              + WinningPlayer.getiPlayerPosition()
              + "("
              + WinningPlayer.getPlayerName()
              + ")");
      displayWinner(
          "Winning Player Position: "
              + WinningPlayer.getiPlayerPosition()
              + " ("
              + WinningPlayer.getPlayerName()
              + ")");
      SetGameControls(eGameState.EndOfGame);

    } else {
      if (iCardDrawnPlayer + iCardDrawnCommon + 2 >= gme.getRule().getTotalCardsToDraw()) {
        for (Player p : mainApp.GetSeatedPlayers()) {
          Hand hPlayer = gme.FindPlayerGame(gme, p).getHand();
          for (int a = hPlayer.getCards().size(); a < gme.getRule().GetPlayerNumberOfCards(); a++) {
            hPlayer.AddCardToHand(new Card(eSuit.JOKER, eRank.JOKER, 0));
          }

          Hand hCommon = gme.FindCommonHand(gme).getHand();

          if (hCommon.getCards() == null) {
            for (int a = 0; a < gme.getRule().GetCommunityCardsCount(); a++) {
              hCommon.AddCardToHand(new Card(eSuit.JOKER, eRank.JOKER, 0));
            }
          } else {

            for (int a = hCommon.getCards().size();
                a < gme.getRule().GetCommunityCardsCount();
                a++) {
              hCommon.AddCardToHand(new Card(eSuit.JOKER, eRank.JOKER, 0));
            }
          }
          ArrayList<Hand> AllHands = Hand.ListHands(hPlayer, hCommon, gme);

          System.out.println(AllHands.get(0).getHandStrength());
        }
      }

      // Re-enable the draw button
      SetGameControls(eGameState);
    }
  }
예제 #9
0
 @Override
 public void stop() {
   animation.pause();
 }
예제 #10
0
 public void play() {
   animation.play();
 }