Java 类javafx.animation.Transition 实例源码

项目:FX-Test    文件:Drag.java   
/**
 * Create an operation dragging from an absolute position to another absolute
 * position in the provided duration
 * 
 * @param d
 *            the duration
 * @param fromX
 *            the start x coordinate on screen
 * @param fromY
 *            the start y coordinate on screen
 * @param toX
 *            the end x coordinate on screen
 * @param toY
 *            the end y coordinate on screen
 * @return the operation
 */
public static Operation to(Duration d, double fromX, double fromY, double toX, double toY) {
    return (r) -> {
        r.mouseMoveTo((int) fromX, (int) fromY);

        BlockCondition<Void> b = new BlockCondition<>();
        double dx = toX - fromX;
        double dy = toY - fromY;
        Transition tt = new Transition() {
            {
                setCycleDuration(javafx.util.Duration.millis(d.toMillis()));
            }

            @Override
            protected void interpolate(double frac) {
                r.mouseMoveTo((int) (fromX + dx * frac), (int) (fromY + dy * frac));
            }
        };
        tt.setOnFinished(e -> b.release(null));
        tt.play();
        r.block(b);
        return r;
    };
}
项目:FX-Test    文件:Drag.java   
/**
 * Create an operation dragging from an absolute position to a relative position
 * from there
 * 
 * @param d
 *            the duration
 * @param fromX
 *            the start x coordinate on screen
 * @param fromY
 *            the start y coordinate on screen
 * @param dx
 *            delta of the x coordinate
 * @param dy
 *            delta of the y coordinate
 * @return the operation
 */
public static Operation by(Duration d, double fromX, double fromY, double dx, double dy) {
    return (r) -> {
        r.mouseMoveTo((int) fromX, (int) fromY);
        r.press(MouseButton.PRIMARY);
        BlockCondition<Void> b = new BlockCondition<>();
        Transition tt = new Transition() {
            {
                setCycleDuration(javafx.util.Duration.millis(d.toMillis()));
            }

            @Override
            protected void interpolate(double frac) {
                r.mouseMoveTo((int) (fromX + dx * frac), (int) (fromY + dy * frac));
            }
        };
        tt.setOnFinished(e -> b.release(null));
        tt.play();
        r.block(b);
        r.release(MouseButton.PRIMARY);
        return r;
    };
}
项目:FX-Test    文件:Move.java   
/**
 * Create operation who moves the cursor from the current mouse position by the
 * provided delta in the provided time
 * 
 * @param d
 *            duration it takes move the delta
 * 
 * @param dx
 *            the x delta
 * @param dy
 *            the y delta
 * @return operation
 */
public static Operation by(Duration d, double dx, double dy) {
    return (r) -> {
        BlockCondition<Void> b = new BlockCondition<>();
        int mouseX = r.mouseX();
        int mouseY = r.mouseY();
        Transition tt = new Transition() {
            {
                setCycleDuration(javafx.util.Duration.millis(d.toMillis()));
            }

            @Override
            protected void interpolate(double frac) {
                r.mouseMoveTo((int) (mouseX + dx * frac), (int) (mouseY + dy * frac));
            }
        };
        tt.setOnFinished(e -> b.release(null));
        tt.play();
        r.block(b);
        return r;
    };
}
项目:FX-Test    文件:Move.java   
/**
 * Move the cursor to the x/y position on the screen
 * 
 * @param d
 *            the duration it takes to reach the provided position
 * 
 * @param x
 *            the absolute x coordinate on the screen
 * @param y
 *            the absolute y coordinate on the screen
 * @return operation
 */
public static Operation to(Duration d, double x, double y) {
    return (r) -> {
        BlockCondition<Void> b = new BlockCondition<>();
        int mouseX = r.mouseX();
        int mouseY = r.mouseY();
        double dx = x - mouseX;
        double dy = y - mouseY;
        Transition tt = new Transition() {
            {
                setCycleDuration(javafx.util.Duration.millis(d.toMillis()));
            }

            @Override
            protected void interpolate(double frac) {
                r.mouseMoveTo((int) (mouseX + dx * frac), (int) (mouseY + dy * frac));
            }
        };
        tt.setOnFinished(e -> b.release(null));
        tt.play();
        r.block(b);
        return r;
    };
}
项目:ExtremeGuiMakeover    文件:AnimatedIcon.java   
private Transition createAnimation(Consumer<Double> fractionConsumer) {
    Transition transition = new Transition() {

        {
            setCycleDuration(animationDuration);
        }

        @Override
        protected void interpolate(double frac) {
            fractionConsumer.accept(frac);


        }
    };
    return transition;
}
项目:H-Uppaal    文件:HUPPAALController.java   
public void collapseMessagesIfNotCollapsed() {
    final Transition collapse = new Transition() {
        double height = tabPaneContainer.getMaxHeight();

        {
            setInterpolator(Interpolator.SPLINE(0.645, 0.045, 0.355, 1));
            setCycleDuration(Duration.millis(200));
        }

        @Override
        protected void interpolate(final double frac) {
            tabPaneContainer.setMaxHeight(((height - 35) * (1 - frac)) + 35);
        }
    };

    if (tabPaneContainer.getMaxHeight() > 35) {
        collapse.play();
    }
}
项目:H-Uppaal    文件:HUPPAALController.java   
@FXML
public void collapseMessagesClicked() {
    final Transition collapse = new Transition() {
        double height = tabPaneContainer.getMaxHeight();

        {
            setInterpolator(Interpolator.SPLINE(0.645, 0.045, 0.355, 1));
            setCycleDuration(Duration.millis(200));
        }

        @Override
        protected void interpolate(final double frac) {
            tabPaneContainer.setMaxHeight(((height - 35) * (1 - frac)) + 35);
        }
    };

    if (tabPaneContainer.getMaxHeight() > 35) {
        collapse.play();
    } else {
        expandMessagesContainer.play();
    }
}
项目:Hostel-Management-System    文件:MainProgramSceneController.java   
@FXML
private void shirnkDetailsAction(ActionEvent event)
{
    if ("Cancel".equals(StudentDetailController.editCancelButton.getText()))
    {
        StudentDetailController.editCancelButtonAction(event);
    }

    final Animation animation = new Transition()
    {

        {
            setCycleDuration(Duration.millis(800));
        }

        @Override
        protected void interpolate(double frac)
        {
            SplitPaneMain.setDividerPosition(0, SplitPaneMain.getDividerPositions()[0]-frac);
        }
    };
    animation.play();
}
项目:Antipleurdawn    文件:BoardHandler.java   
private void displayWinningScreen()
{
    final int maxSize = 100;

    scene.lookup("#endGameScreen").setStyle("visibility: visible");

    displayOverlay();

    Label endGameText = (Label)scene.lookup("#endGameText");
    endGameText.setText("You Win!");
    endGameText.getStyleClass().add("winningLabel");
    endGameText.setStyle("visibility: visible");

    Transition fontIncrease = new Transition() {
        {
            setCycleDuration(Duration.millis(1000));
        }
        @Override
        protected void interpolate(double frac) {
            endGameText.setStyle("-fx-font-size: " + Math.pow(frac, 3) * maxSize + "px");
        }
    };
    fontIncrease.setOnFinished(event -> scene.lookup("#endGameButtons").setStyle("visibility: visible"));
    fontIncrease.play();
}
项目:truffle-hog    文件:BasicEdgeRenderer.java   
public BasicEdgeRenderer() {

       // line.setStroke(colorUnpicked);
        line.strokeProperty().bind(arrowStrokePaintProperty);
        arrowShape.fillProperty().bind(arrowHeadFillProperty);

        //animator = new StrokeTransition(Duration.millis(animationTime), arrowStrokePaintProperty, Color.WHITE);

        animator = new Transition() {
            {
                setCycleDuration(Duration.millis(animationTime));
            }
            protected void interpolate(double frac) {

                arrowStrokePaintProperty.set(currentEdgeStrokePaint.interpolate(currentAnimationEndColor, frac));
                arrowHeadFillProperty.set(currentArrowFill.interpolate(currentAnimationEndColor, frac));
            }
        };
        animator.setCycleCount(2);
        animator.setAutoReverse(true);
    }
项目:truffle-hog    文件:MulticastEdgeRenderer.java   
public MulticastEdgeRenderer() {

        circle.setFill(Color.WHITE);
        circle.setVisible(false);



        animator = new Transition() {

            {
                setCycleDuration(Duration.millis(animationTime));
            }

            @Override
            protected void interpolate(double frac) {

                circle.setRadius(frac * 1000);
                circle.setOpacity(1 - frac);

            }
        };
        animator.setCycleCount(2);
        animator.setOnFinished(e -> {
            circle.setVisible(false);
        });
    }
项目:contentment    文件:BeatWaiter.java   
public void stepFinished()
{
    animator = new Transition()
    {
        {
            setCycleDuration(Duration.INDEFINITE);
        }

        @Override
        protected void interpolate(double frac)
        {
            if (isDone.get())
            {
                finishAndDie();
            }
        }

    };
    animator.play();
}
项目:TweetwallFX    文件:CloudFadeOutStep.java   
@Override
public void doStep(final MachineContext context) {
    WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");

    List<Transition> fadeOutTransitions = new ArrayList<>();

    Duration defaultDuration = Duration.seconds(1.5);

    // kill the remaining words from the cloud
    wordleSkin.word2TextMap.entrySet().forEach(entry -> {
        Text textNode = entry.getValue();
        FadeTransition ft = new FadeTransition(defaultDuration, textNode);
        ft.setToValue(0);
        ft.setOnFinished((event) -> {
            wordleSkin.getPane().getChildren().remove(textNode);
        });
        fadeOutTransitions.add(ft);
    });
    wordleSkin.word2TextMap.clear();

    ParallelTransition fadeLOuts = new ParallelTransition();

    fadeLOuts.getChildren().addAll(fadeOutTransitions);
    fadeLOuts.setOnFinished(e -> context.proceed());
    fadeLOuts.play();
}
项目:TweetwallFX    文件:ImageMosaicStep.java   
@Override
public void doStep(final MachineContext context) {
    WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");
    ImageMosaicDataProvider dataProvider = context.getDataProvider(ImageMosaicDataProvider.class);
    pane = wordleSkin.getPane();
    if (dataProvider.getImages().size() < 35) {
        context.proceed();
    } else {
        Transition createMosaicTransition = createMosaicTransition(dataProvider.getImages());
        createMosaicTransition.setOnFinished((ActionEvent event) -> {
            executeAnimations(context);
        });

        createMosaicTransition.play();
    }
}
项目:GRIP    文件:ExceptionWitnessResponderButton.java   
/**
 * @param origin The same origin that is passed to the
 * {@link edu.wpi.grip.core.util.ExceptionWitness}
 */
@Inject
ExceptionWitnessResponderButton(@Assisted Object origin, @Assisted String popOverTitle) {
  super();

  this.origin = checkNotNull(origin, "The origin can not be null");
  this.popOverTitle = checkNotNull(popOverTitle, "The pop over title can not be null");
  this.tooltip = new Tooltip();
  this.getStyleClass().add(STYLE_CLASS);

  final ImageView icon = new ImageView("/edu/wpi/grip/ui/icons/warning.png");

  setOnMouseClicked(event -> getPopover().show(this));
  setVisible(false);
  setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
  setGraphic(icon);
  icon.setFitWidth(DPIUtility.SMALL_ICON_SIZE);
  icon.setFitHeight(DPIUtility.SMALL_ICON_SIZE);

  FadeTransition ft = new FadeTransition(Duration.millis(750), icon);
  ft.setToValue(0.1);
  ft.setCycleCount(Transition.INDEFINITE);
  ft.setAutoReverse(true);
  ft.play();
}
项目:GRIP    文件:StartStoppableButton.java   
/**
 * Gets the graphic that should be used for the button given the current source's state
 *
 * @return The graphic to show on the button.
 */
private static ImageView pickGraphic(RestartableService startStoppable) {
  final boolean running = startStoppable.isRunning();
  final ImageView icon = running ? new ImageView(stopImage) : new ImageView(startImage);
  if (!running) {
    // If we are not running then we want the icon to flash
    final FadeTransition ft = new FadeTransition(Duration.millis(750), icon);
    ft.setToValue(0.1);
    ft.setCycleCount(Transition.INDEFINITE);
    ft.setAutoReverse(true);
    ft.play();
  }
  icon.setFitHeight(DPIUtility.MINI_ICON_SIZE);
  icon.setFitWidth(DPIUtility.MINI_ICON_SIZE);
  return icon;
}
项目:FEFEditor    文件:FilledSliderSkin.java   
/**
 * Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed.
 */
void positionThumb(final boolean animate) {
    Slider s = getSkinnable();
    if (s.getValue() > s.getMax()) return;// this can happen if we are bound to something
    boolean horizontal = s.getOrientation() == Orientation.HORIZONTAL;
    final double endX = (horizontal) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) /
            (s.getMax() - s.getMin()))) - thumbWidth / 2)) : thumbLeft;
    final double endY = (horizontal) ? thumbTop :
            snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) /
                    (s.getMax() - s.getMin()))); //  - thumbHeight/2

    if (animate) {
        // lets animate the thumb transition
        final double startX = thumb.getLayoutX();
        final double startY = thumb.getLayoutY();
        Transition transition = new Transition() {
            {
                setCycleDuration(Duration.millis(200));
            }

            @Override
            protected void interpolate(double frac) {
                if (!Double.isNaN(startX)) {
                    thumb.setLayoutX(startX + frac * (endX - startX));
                }
                if (!Double.isNaN(startY)) {
                    thumb.setLayoutY(startY + frac * (endY - startY));
                }
            }
        };
        transition.play();
    } else {
        thumb.setLayoutX(endX);
        thumb.setLayoutY(endY);
    }
}
项目:3DSFE-Randomizer    文件:FilledSliderSkin.java   
/**
 * Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed.
 */
void positionThumb(final boolean animate) {
    Slider s = getSkinnable();
    if (s.getValue() > s.getMax()) return;// this can happen if we are bound to something
    boolean horizontal = s.getOrientation() == Orientation.HORIZONTAL;
    final double endX = (horizontal) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) /
            (s.getMax() - s.getMin()))) - thumbWidth/2)) : thumbLeft;
    final double endY = (horizontal) ? thumbTop :
            snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) /
                    (s.getMax() - s.getMin()))); //  - thumbHeight/2

    if (animate) {
        // lets animate the thumb transition
        final double startX = thumb.getLayoutX();
        final double startY = thumb.getLayoutY();
        Transition transition = new Transition() {
            {
                setCycleDuration(Duration.millis(200));
            }

            @Override protected void interpolate(double frac) {
                if (!Double.isNaN(startX)) {
                    thumb.setLayoutX(startX + frac * (endX - startX));
                }
                if (!Double.isNaN(startY)) {
                    thumb.setLayoutY(startY + frac * (endY - startY));
                }
            }
        };
        transition.play();
    } else {
        thumb.setLayoutX(endX);
        thumb.setLayoutY(endY);
    }
}
项目:GazePlay    文件:JeuAnimaux.java   
public void createAnimation(){

        Animation animation = new Transition() {

            {
                setCycleDuration(Duration.millis(3000));
                hboxFirst.getChildren().removeAll(imgView1, imgView2, imgView3);
                hboxFirst.getChildren().add(imgView4);
                String musicFileBravo =  System.getProperties().getProperty("user.home") + File.separator + "GazePlay" + File.separator + "files" + File.separator + "myGame"+File.separator+"applause.mp3";
                File fSound = new File(musicFileBravo);

                Media firstSound = new Media(fSound.toURI().toString());
                MediaPlayer mediaPlayerBravo = new MediaPlayer(firstSound);
                mediaPlayerBravo.play();
            }

            @Override
            protected void interpolate(double frac) {
                final int n = Math.round(3000 * (float) frac);

            }
        };

        animation.play();

        animation.setOnFinished(new EventHandler<ActionEvent>() {


            @Override
            public void handle(ActionEvent actionEvent) {

                hboxFirst.getChildren().removeAll(imgView4);
                createGame(sceneFirst, hboxFirst);

            }
        });

    }
项目:ExtremeGuiMakeover    文件:AnimatedIcon.java   
private Transition create(Line line, double startX, double startY, double endX, double endY) {
    double currentStartX = line.getStartX();
    double currentStartY = line.getStartY();
    double currentEndX = line.getEndX();
    double currentEndY = line.getEndY();

    return createAnimation(frac -> {
        line.setStartX(currentStartX + (startX - currentStartX) * frac);
        line.setStartY(currentStartY + (startY - currentStartY) * frac);
        line.setEndX(currentEndX + (endX - currentEndX) * frac);
        line.setEndY(currentEndY + (endY - currentEndY) * frac);
    });
}
项目:H-Uppaal    文件:ComponentController.java   
public void toggleDeclaration(final MouseEvent mouseEvent) {
    final Circle circle = new Circle(0);
    circle.setCenterX(component.get().getWidth() - (toggleDeclarationButton.getWidth() - mouseEvent.getX()));
    circle.setCenterY(-1 * mouseEvent.getY());

    final ObjectProperty<Node> clip = new SimpleObjectProperty<>(circle);
    declaration.clipProperty().bind(clip);

    final Transition rippleEffect = new Transition() {
        private final double maxRadius = Math.sqrt(Math.pow(getComponent().getWidth(), 2) + Math.pow(getComponent().getHeight(), 2));

        {
            setCycleDuration(Duration.millis(500));
        }

        protected void interpolate(final double fraction) {
            if (getComponent().isDeclarationOpen()) {
                circle.setRadius(fraction * maxRadius);
            } else {
                circle.setRadius(maxRadius - fraction * maxRadius);
            }
            clip.set(circle);
        }
    };

    final Interpolator interpolator = Interpolator.SPLINE(0.785, 0.135, 0.15, 0.86);
    rippleEffect.setInterpolator(interpolator);

    rippleEffect.play();
    getComponent().declarationOpenProperty().set(!getComponent().isDeclarationOpen());
}
项目:ClearComposer    文件:GraphicNote.java   
/**
 * changes color to white and fades it back to ordinary color
 */
protected void playColor()
{
    if (on == NotePlayState.OFF)
        return;

    if (on == NotePlayState.ON_TEMP)
        on = NotePlayState.OFF;

    Color stroke = (Color)getStroke();
    ft = new Transition()
    {
        {
            setCycleDuration(TRANSITION_DURATION);
        }
        @Override
        protected void interpolate(double frac)
        {
            if (on != NotePlayState.OFF)
            {
                setFill(FILL_PLAY.interpolate(fillOn, frac));
                setStroke(stroke.interpolate(on == NotePlayState.ON_PERMA ? PERMA_STROKE : fillOn.invert(), frac));
            }
            else
            {
                setFill(FILL_PLAY.interpolate(FILL_OFF, frac));
                setStroke(stroke.interpolate(PERMA_STROKE, frac));
            }
        }
    };
    ft.play();

    ClearComposer.cc.updateNotes();
}
项目:JFoenix    文件:IconsController.java   
private void bindAction(JFXHamburger burger) {
    burger.setOnMouseClicked((e) -> {
        final Transition burgerAnimation = burger.getAnimation();
        burgerAnimation.setRate(burgerAnimation.getRate() * -1);
        burgerAnimation.play();
    });
}
项目:fr.xs.jtk    文件:AnimatedCameraController.java   
public AnimatedCameraController(AnimationPreference movementType) {
    animPref = movementType;
    switch(animPref) {
    case TIMELINE:
        timeline = new Timeline();
        timeline.setCycleCount(Animation.INDEFINITE);
        break;
    case TIMER:
        timer = new AnimationTimer() {
            @Override
            public void handle(long l) {
                update();
            }
        };
        break;
    case TRANSITION:
        transition = new Transition() {
            {
                setCycleDuration(Duration.seconds(1));
            }

            @Override
            protected void interpolate(double frac) {
                updateTransition(frac);
            }
        };
        transition.setCycleCount(Animation.INDEFINITE);
        break;
    case ANIMATION:
        break;
    }

}
项目:FXyzLib    文件:CameraController.java   
public CameraController(boolean enableTransforms, AnimationPreference movementType) {
    enable = enableTransforms;
    animPref = movementType;
    switch (animPref) {
        case TIMELINE:
            timeline = new Timeline();
            timeline.setCycleCount(Animation.INDEFINITE);
            break;
        case TIMER:
            timer = new AnimationTimer() {
                @Override
                public void handle(long l) {
                    if (enable) {
                        initialize();
                        enable = false;
                    }
                    update();
                }
            };
            break;
        case TRANSITION:
            transition = new Transition() {
                {setCycleDuration(Duration.seconds(1));}
                @Override
                protected void interpolate(double frac) {
                    updateTransition(frac);
                }
            };
            transition.setCycleCount(Animation.INDEFINITE);
            break;
        case ANIMATION:

            break;
    }

}
项目:contentment    文件:AnimationsGuaranteeOneTest.java   
@Test
public void test() throws Exception
{
    System.out.println(Platform.isFxApplicationThread());
    oneReceived = false;
    CountDownLatch latch = new CountDownLatch(1);
    Transition transition = new Transition()
    {

        {
            System.out.println(getCycleDuration());
            setCycleDuration(Duration.ONE);
        }

        @Override
        protected void interpolate(double frac)
        {
            if (frac == 1d)
            {
                oneReceived = true;
                latch.countDown();
            }

        }
    };
    runner.play(transition);
    assertThat(oneReceived).isTrue();
}
项目:contentment    文件:JavaFxRunner.java   
public void play(Transition transition)
{
    Consumer<CountDownLatch> action = new Consumer<CountDownLatch>()
    {
        @Override
        public void accept(CountDownLatch latch)
        {
            transition.setOnFinished((event) -> latch.countDown());
            transition.play();
        }
    };
    actLater(action);

}
项目:TweetwallFX    文件:Devoxx17FlipOutTweets.java   
@Override
public void doStep(final MachineContext context) {
    WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");
    VBox vbox = (VBox) wordleSkin.getNode().lookup("#tweetList");

    List<Transition> transitions = new ArrayList<>();
    vbox.getChildren().forEach(node -> transitions.add(new FlipOutXTransition(node)));
    Node imageNode = wordleSkin.getNode().lookup("#tweetImage");
    ParallelTransition flipOuts = new ParallelTransition();
    if (null != imageNode) {
        FadeTransition fadeTransition = new FadeTransition(Duration.seconds(2), imageNode);
        fadeTransition.setDelay(Duration.seconds(0.2));
        fadeTransition.fromValueProperty().setValue(1);
        fadeTransition.toValueProperty().setValue(0);
        flipOuts.getChildren().add(fadeTransition);
    }
    flipOuts.getChildren().addAll(transitions);
    flipOuts.setOnFinished(e -> {
        vbox.getChildren().removeAll();
        wordleSkin.getPane().getChildren().remove(vbox);
        if (null != imageNode) {
            wordleSkin.getPane().getChildren().remove(imageNode);
        }
        context.proceed();
    });
    flipOuts.play();
}
项目:TweetwallFX    文件:ImageMosaicStep.java   
private void executeAnimations(final MachineContext context) {
    ImageWallAnimationTransition highlightAndZoomTransition
            = createHighlightAndZoomTransition();
    highlightAndZoomTransition.transition.play();
    highlightAndZoomTransition.transition.setOnFinished((event1) -> {
        Transition revert
                = createReverseHighlightAndZoomTransition(highlightAndZoomTransition.column, highlightAndZoomTransition.row);
        revert.setDelay(Duration.seconds(3));
        revert.play();
        revert.setOnFinished((ActionEvent event) -> {
            count++;
            if (count < 3) {
                executeAnimations(context);
            } else {
                count = 0;
                ParallelTransition cleanup = new ParallelTransition();
                for (int i = 0; i < 6; i++) {
                    for (int j = 0; j < 5; j++) {
                        FadeTransition ft = new FadeTransition(Duration.seconds(0.5), rects[i][j]);
                        ft.setToValue(0);
                        cleanup.getChildren().addAll(ft);
                    }
                }
                cleanup.setOnFinished((cleanUpDown) -> {
                    for (int i = 0; i < 6; i++) {
                        for (int j = 0; j < 5; j++) {
                            pane.getChildren().remove(rects[i][j]);
                        }
                    }
                    highlightedIndexes.clear();
                    context.proceed();
                });
                cleanup.play();
            }
        });
    });
}
项目:TweetwallFX    文件:ImageMosaicStep.java   
private Transition createMosaicTransition(final List<ImageStore> imageStores) {
    SequentialTransition fadeIn = new SequentialTransition();
    List<FadeTransition> allFadeIns = new ArrayList<>();

    double width = pane.getWidth() / 6.0 - 10;
    double height = pane.getHeight() / 5.0 - 8;
    List<ImageStore> distillingList = new LinkedList<>(imageStores);
    for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 5; j++) {
            int index = RANDOM.nextInt(distillingList.size());
            ImageStore selectedImage = distillingList.remove(index);
            ImageView imageView = new ImageView(selectedImage.getImage());
            imageView.setCache(true);
            imageView.setCacheHint(CacheHint.SPEED);
            imageView.setFitWidth(width);
            imageView.setFitHeight(height);
            imageView.setEffect(new GaussianBlur(0));
            rects[i][j] = imageView;
            bounds[i][j] = new BoundingBox(i * (width + 10) + 5, j * (height + 8) + 4, width, height);
            rects[i][j].setOpacity(0);
            rects[i][j].setLayoutX(bounds[i][j].getMinX());
            rects[i][j].setLayoutY(bounds[i][j].getMinY());
            pane.getChildren().add(rects[i][j]);
            FadeTransition ft = new FadeTransition(Duration.seconds(0.3), imageView);
            ft.setToValue(1);
            allFadeIns.add(ft);
        }
    }
    Collections.shuffle(allFadeIns);
    fadeIn.getChildren().addAll(allFadeIns);
    return fadeIn;
}
项目:FX3DAndroid    文件:CameraController.java   
public CameraController(boolean enableTransforms, AnimationPreference movementType) {
    enable = enableTransforms;
    animPref = movementType;
    switch (animPref) {
        case TIMELINE:
            timeline = new Timeline();
            timeline.setCycleCount(Animation.INDEFINITE);
            break;
        case TIMER:
            timer = new AnimationTimer() {
                @Override
                public void handle(long l) {
                    if (enable) {
                        initialize();
                        enable = false;
                    }
                    update();
                }
            };
            break;
        case TRANSITION:
            transition = new Transition() {
                {setCycleDuration(Duration.seconds(1));}
                @Override
                protected void interpolate(double frac) {
                    updateTransition(frac);
                }
            };
            transition.setCycleCount(Animation.INDEFINITE);
            break;
        case ANIMATION:

            break;
    }

}
项目:mephisto_iii    文件:ControllableSelectorPanel.java   
protected void scroll(boolean toLeft, int width) {
  if(index == getItemCount() && !toLeft) {
    return;
  }
  if(index == 1 && getItemCount() == 1 && !toLeft) {
    return;
  }
  if(index == 0 && toLeft) {
    return;
  }

  //ignore scrolling when back button is available and selected
  if(backTopPadding == -1 && index == 1 && toLeft) {
    updateSelection(toLeft);
    return;
  }

  if(index != 0 || backTopPadding != -1) {
    Transition translateTransition = TransitionUtil.createTranslateByXTransition(this, 50, width);
    transitionQueue.addTransition(translateTransition);

    Platform.runLater(new Runnable() {
      @Override
      public void run() {
        transitionQueue.play();
      }
    });
  }

  updateSelection(toLeft);
}
项目:piupiu    文件:ParticleExplosion.java   
/**
 * Plays back all of the transitions for the individual particles and 
 * removes this instance of ParticleExplosion.
 * PreCondition: We have set up our ParticleExplosion with generated particles and this resides within a Pane.
 * PostCondition: The particles have been animated and this instance has been removed from the parent Pane.
 */
public void explode() {
    //Play the animations and destroy this instance of ParticleExplosion
    for (Transition transition : transitions) {
        transition.play();
    }
}
项目:RadialFx    文件:RadialGlobalMenu.java   
private Transition createOpacityTransition(final Node node,
    final double from, final double to) {
final FadeTransition fadeIn = FadeTransitionBuilder.create().node(node)
    .fromValue(from).toValue(to).duration(Duration.millis(200))
    .build();
backContainer.setOpacity(from);
return fadeIn;

   }
项目:ExtremeGuiMakeover    文件:AnimatedIcon.java   
private Transition createRotationTransition(double rotate) {
    double currentRotation = getRotate();
    return createAnimation(frac -> setRotate(currentRotation + (rotate - currentRotation) * frac));
}
项目:ExtremeGuiMakeover    文件:AnimatedIcon.java   
private Transition createOpacityTransition(Line line, double opacity) {
    double currentOpacity = line.getOpacity();
    return createAnimation(frac -> line.setOpacity(currentOpacity + (opacity - currentOpacity) * frac));
}
项目:Gargoyle    文件:FxUtil.java   
public static Transition createTransition(Node node, AnimationType type) {
    return AnimationUtils.createTransition(node, type);
}
项目:Gargoyle    文件:FxUtil.java   
public static Transition createFadeInTransition(Node node) {
    return createTransition(node, AnimationType.FADE_IN);
}
项目:Gargoyle    文件:FxUtil.java   
public static Transition createBounceInTransition(Node node) {
    return createTransition(node, AnimationType.BOUNCE_IN);
}
项目:livro-javafx-pratico    文件:AprendendoTransicoes.java   
public static Transition fazerTransicao(Transicoes transicao, double duracaoSegundos, Node alvo) {
    Duration duracao = new Duration(duracaoSegundos * 1000);
    Transition t = null;

    switch (transicao) {
    case FADE:
        FadeTransition fadeTransition = new FadeTransition();
        fadeTransition.setFromValue(1);
        fadeTransition.setToValue(0);
        fadeTransition.setDuration(duracao);
        fadeTransition.setNode(alvo);
        t = fadeTransition;
        break;
    case FILL:
        FillTransition fillTransition = new FillTransition();
        fillTransition.setFromValue(Color.RED);
        fillTransition.setToValue(Color.DARKGREEN);
        fillTransition.setDuration(duracao);
        fillTransition.setShape((Shape) alvo);
        t = fillTransition;
        break;
    case ROTATE:
        RotateTransition rotateTransition = new RotateTransition();
        rotateTransition.setByAngle(360);
        rotateTransition.setDuration(duracao);
        rotateTransition.setNode(alvo);
        t = rotateTransition;
        break;
    case SCALE:
        ScaleTransition scaleTransition = new ScaleTransition();
        scaleTransition.setFromX(1);
        scaleTransition.setFromY(1);
        scaleTransition.setToX(4);
        scaleTransition.setToY(4);
        scaleTransition.setDuration(duracao);
        scaleTransition.setNode(alvo);
        t = scaleTransition;
        break;
    case TRANSLATE:
        TranslateTransition translateTransition = new TranslateTransition();
        translateTransition.setToX(600);
        translateTransition.setToY(250);
        translateTransition.setDuration(duracao);
        translateTransition.setNode(alvo);
        t = translateTransition;
        break;
    default:
        break;
    }
    t.setAutoReverse(true);
    t.setCycleCount(2);
    return t;
}