/** * Builds the text part animation. * * @param textNode the text node * @return the animation */ private Animation buildTextPartAnimation(final Text textNode) { return ParallelTransitionBuilder.create() .node(textNode) .children( ScaleTransitionBuilder.create() .duration(Duration.millis(300)) // SHOULD BE CONFIGURABLE (Game Speed) .fromX(0.0).toX(1.0) .fromY(0.0).toY(1.0) .build()) .build(); }
/** * Gets the expression resolved. * * @return the expression resolved */ private Animation buildExpressionResolved() { return ParallelTransitionBuilder.create() .delay(Duration.millis(400)) .children( ScaleTransitionBuilder.create() .node(this.result) .fromX(1).toX(4.0) .fromY(1).toY(4.0) .build(), ScaleTransitionBuilder.create() .node(getLeftOperand()) .fromX(1).toX(0) .fromY(1).toY(0) .build(), ScaleTransitionBuilder.create() .node(getOperator()) .fromX(1).toX(0) .fromY(1).toY(0) .build(), ScaleTransitionBuilder.create() .node(getRightOperand()) .fromX(1).toX(0) .fromY(1).toY(0) .build(), ScaleTransitionBuilder.create() .node(getEquality()) .fromX(1).toX(0) .fromY(1).toY(0) .build()) .build(); }
/** * {@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(); }
/** * Build a bean animation. * * @param label the attached label * @param shape the shape to show * @param fillColor the color to use to paint the shape * * @return the bean animation */ private Animation buildBeanAnimation(final Label label, final Shape shape, final Color fillColor) { return ParallelTransitionBuilder.create() .children( ScaleTransitionBuilder.create().node(label).delay(Duration.millis(50)).duration(Duration.millis(300)) .fromX(0).fromY(0).toX(1).toY(1).build(), FillTransitionBuilder.create().shape(shape) .fromValue(Color.LIGHTGREY).toValue(fillColor) .build()) .build(); }
/** * 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(); }
/** * 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(); }
/** * TODO To complete. * * @param gf * @return */ protected Animation getParallel(final Animation... animation) { return ParallelTransitionBuilder.create().children(animation).build(); }