Java 类javafx.animation.ScaleTransition 实例源码

项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * 
 * @param root 
 */
private void setExitAnimationToNode(Node root) {
    if(about.isShowing()) {
        this.popupCloser(about, about_box);
    }
    if(help.isShowing()) {
        this.popupCloser(help, help_box);
    }
    ScaleTransition st = new ScaleTransition(Duration.seconds(.4), root);
    st.setToX(0);
    st.setToY(0);
    st.play();

    FadeTransition fd = new FadeTransition(Duration.seconds(.3), root);
    fd.setToValue(.1);
    fd.play();

    st.setOnFinished(e -> Platform.exit());
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * 
 * @param b 
 */
public void buttonClicked(Button b, KeyCode key) {
    ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
    st.setFromX(.8);
    st.setFromY(.8);
    st.setToX(1.6);
    st.setToY(1.6);
    st.play();

    FadeTransition ft = new FadeTransition(Duration.seconds(.2), b);
    ft.setFromValue(.2);
    ft.setToValue(1);
    ft.play();  

    boolean movable = true;
    Direction direction = new Direction(key);
    if(direction.getKey().equals(KeyCode.UP)) movable = this.upMove(direction);
    if(direction.getKey().equals(KeyCode.RIGHT)) movable = this.rightMove(direction);
    if(direction.getKey().equals(KeyCode.DOWN)) movable = this.downMove(direction);
    if(direction.getKey().equals(KeyCode.LEFT)) movable = this.leftMove(direction);
    if(movable) {   
        int random_value = ((int)(new Random().nextDouble() * 10)) > 8 ? 4 : 2;
        this.addNewTile(String.valueOf(random_value), Duration.seconds(.2));
    }

}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * Animation for key pressed.
 * @param b 
 */
private void keyPressedAnimation(Button b) {
    ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
    st.setFromX(.8);
    st.setFromY(.8);
    st.setToX(1.6);
    st.setToY(1.6);
    st.play();
    st.setOnFinished(e -> {
        if(!b.isHover()) {
            ScaleTransition st2 = new ScaleTransition(Duration.seconds(.09), b);
            st2.setToX(1);
            st2.setToY(1);
            st2.play();
        }
    });

    FadeTransition ft = new FadeTransition(Duration.seconds(.2), b);
    ft.setFromValue(.2);
    ft.setToValue(1);
    ft.play();  
}
项目:LCL    文件:Transition.java   
public static void lollipop(double x, double y) {
    Circle circle = new Circle(x, y, 2);
    circle.setFill(randomColor());
    FrameController.instance.hover.getChildren().add(circle);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), circle);
    fadeTransition.setAutoReverse(true);
    fadeTransition.setCycleCount(2);
    fadeTransition.setFromValue(0.0);
    fadeTransition.setToValue(1.0);
    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(1000), circle);
    scaleTransition.setToX(10.0);
    scaleTransition.setToY(10.0);
    scaleTransition.setCycleCount(1);
    ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
    parallelTransition.play();
    executorService.schedule(() -> Platform.runLater(() ->
            FrameController.instance.hover.getChildren().remove(circle)), 1000, TimeUnit.MILLISECONDS);
}
项目:FXGLGames    文件:GameController.java   
private Animation getAnimationLoseLife(Texture texture) {
    texture.setFitWidth(64);
    texture.setFitHeight(64);

    Viewport viewport = gameScene.getViewport();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.66), texture);
    tt.setToX(viewport.getWidth() / 2 - texture.getFitWidth() / 2);
    tt.setToY(viewport.getHeight() / 2 - texture.getFitHeight() / 2);

    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), texture);
    st.setToX(0);
    st.setToY(0);

    return new SequentialTransition(tt, st);
}
项目:Forum-Notifier    文件:ParticleAnimation.java   
private void animate(Circle particle, Path path) {
    Random randGen = new Random();

    PathTransition pathTransition = new PathTransition(Duration.seconds(path.getElements().size() * (randGen.nextInt(30) + 30)), path, particle);
    pathTransition.setInterpolator(Interpolator.EASE_OUT);

    ScaleTransition scaleTransition = new ScaleTransition(Duration.seconds(3f), particle);
    scaleTransition.setToX(10f);
    scaleTransition.setToY(10f);
    scaleTransition.setInterpolator(Interpolator.EASE_OUT);

    FadeTransition fadeTransition = new FadeTransition(Duration.seconds(6f), particle);
    fadeTransition.setToValue(0.7);
    fadeTransition.setInterpolator(Interpolator.EASE_OUT);

    pathTransition.play();
    scaleTransition.play();
    fadeTransition.play();
}
项目:programmierpraktikum-abschlussprojekt-amigos    文件:ExerciseController.java   
private void doOutputScaleAnimation(){
    ParallelTransition pt = new ParallelTransition();
    for(Node c : outputTabContainer.getChildren()){
        if(c == compilerArea) continue;
        ScaleTransition scale = new ScaleTransition(Duration.millis(250), c);
        scale.setFromX(1);
        scale.setToX(1.15);
        scale.setFromY(1);
        scale.setToY(1.15);
        scale.setAutoReverse(true);
        scale.setCycleCount(2);
        pt.getChildren().add(scale);
    }
    pt.play();

}
项目:FakeImageDetection    文件:LaunchScreeenController.java   
private void animate() {
    TranslateTransition tt = new TranslateTransition(Duration.millis(duration), load_image_button);
    TranslateTransition tLogo = new TranslateTransition(Duration.millis(duration), christopher);
    TranslateTransition tDesc = new TranslateTransition(Duration.millis(duration), description);

    ScaleTransition st = new ScaleTransition(Duration.millis(duration), load_image_button);
    st.setToX(3);
    st.setToY(3);

    tt.setByY(-180f);

    tLogo.setToY(50);
    tDesc.setToY(500);
    buttonParallelTransition = new ParallelTransition(load_image_button, st, tt, tLogo, tDesc);

    buttonParallelTransition.play();
    buttonParallelTransition.setOnFinished((e) -> {
        load_image_button.setOpacity(1);
    });
}
项目:Simulizer    文件:InternalWindow.java   
/**
 * Performs an animation to get the users attention
 *
 * @param sf
 *            the scale factor to enlarge the window by (1.0 => no scale)
 */
protected final void emphasise(double sf) {
    // Ignore if window is just being opened
    if (getScaleX() == 1 && getScaleY() == 1 && !isExtracted) {
        ScaleTransition sc = new ScaleTransition(Duration.millis(175), this);
        sc.setToX(sf);
        sc.setToY(sf);
        sc.setCycleCount(2);
        sc.setAutoReverse(true);
        getStyleClass().add("highlighting");
        sc.setOnFinished((e) -> getStyleClass().remove("highlighting"));
        sc.play();
        toFront();
    } else if (isExtracted) {
        extractedStage.toFront();
    }
}
项目:javaFXMDI    文件:MDIWindow.java   
public void closeMdiWindow() {
    ScaleTransition st = new ScaleTransition(Duration.millis(100), borderPane);
    st.setToX(0);
    st.setToY(0);
    st.setByX(1);
    st.setByY(1);

    st.setCycleCount(1);

    st.play();
    borderPane.fireEvent(new MDIEvent(null, MDIEvent.EVENT_CLOSED));
    st.setOnFinished((ActionEvent t) -> {

        MDICanvas mdiCanvas = (MDICanvas) this.getParent().getParent();
        for (int i = 0; i < mdiCanvas.getPaneMDIContainer().getChildren().size(); i++) {
            MDIWindow window = (MDIWindow) mdiCanvas.getPaneMDIContainer().getChildren().get(i);
            if (window.getId().equals(borderPane.getId())) {
                mdiCanvas.getPaneMDIContainer().getChildren().remove(i);
            }
        }
        isClosed.setValue(true);
    });
}
项目:FXGLGames    文件:GameController.java   
private Animation getAnimationLoseLife(Texture texture) {
    texture.setFitWidth(64);
    texture.setFitHeight(64);

    Viewport viewport = gameScene.getViewport();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.66), texture);
    tt.setToX(viewport.getWidth() / 2 - texture.getFitWidth() / 2);
    tt.setToY(viewport.getHeight() / 2 - texture.getFitHeight() / 2);

    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), texture);
    st.setToX(0);
    st.setToY(0);

    return new SequentialTransition(tt, st);
}
项目:The-Projects    文件:Board.java   
/**
 * Method to display the movement of a card to a Deck
 * @param card the card to move
 */
private PathTransition moveToDeck(Card card) {
    StackPane deck = ownerToDeck(card.getOwner());
    Path path = new Path(new MoveTo(card.localToParent(0,0).getX() + card.getWidth()/2, card.localToParent(0,0).getY() + card.getHeight()/2),
            new LineTo(deck.localToParent(deck.getWidth()/2.,deck.getHeight()/2.).getX(), deck.localToParent(deck.getWidth()/2.,deck.getHeight()/2.).getY()));

    boolean horizontal = card.getOwner() == Owner.PROJECT_DECK || card.getOwner() == Owner.PROJECT_DISCARD;

    card.toFront();
    if (horizontal) {
        RotateTransition rotateTransition = new RotateTransition(Duration.millis(500), card);
        rotateTransition.setByAngle(-90);
        rotateTransition.play();
    }

    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(500), card);
    scaleTransition.setToX(horizontal ? deck.getScaleY() : deck.getScaleX());
    scaleTransition.setToY(horizontal ? deck.getScaleX() : deck.getScaleY());
    scaleTransition.play();

    card.setClickable(false, view);

    return new PathTransition(Duration.seconds(.5),path,card);
}
项目:JVx.javafx    文件:StackedScenePane.java   
/**
 * Animates a custom button with a scale transition.
 * 
 * @param pButton the button
 * @see ScaleTransition
 */
private void animateButton(Button pButton)
{
    pButton.setEffect(effButtonColorAdjust);

    Animation an = htButtonAnimations.get(pButton);

    if (an != null)
    {
        an.playFromStart();
    }
    else
    {
        ScaleTransition st = new ScaleTransition(Duration.millis(120), pButton);
        st.setByX(0.4f);
        st.setByY(0.4f);
        st.setCycleCount(2);
        st.setAutoReverse(true);

        htButtonAnimations.put(pButton, st);

        st.play();
    }
}
项目:bco.bcozy    文件:LocationPane.java   
private void autoFocusPolygonAnimated(final LocationPolygon polygon) {
    final double xScale = (foregroundPane.getBoundingBox().getWidth() / polygon.prefWidth(0))
            * Constants.ZOOM_FIT_PERCENTAGE_WIDTH;
    final double yScale = (foregroundPane.getBoundingBox().getHeight() / polygon.prefHeight(0))
            * Constants.ZOOM_FIT_PERCENTAGE_HEIGHT;
    final double scale = (xScale < yScale) ? xScale : yScale;

    final ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(500));
    scaleTransition.setToX(scale);
    scaleTransition.setToY(scale);
    scaleTransition.setCycleCount(1);
    scaleTransition.setAutoReverse(true);

    final Point2D transition = calculateTransition(scale, polygon);

    final TranslateTransition translateTransition = new TranslateTransition(Duration.millis(500));
    translateTransition.setToX(transition.getX());
    translateTransition.setToY(transition.getY());
    translateTransition.setCycleCount(1);
    translateTransition.setAutoReverse(true);

    final ParallelTransition parallelTransition
            = new ParallelTransition(this, scaleTransition, translateTransition);
    parallelTransition.play();
}
项目:Tourney    文件:MaterialTextField.java   
private void initializePromptMoveTransition() {
    ScaleTransition promptScale = new ScaleTransition(promptAnimationDuration, this.promptLabel);
    promptScale.setFromX(1);
    promptScale.setFromY(1);
    promptScale.setToX(.7);
    promptScale.setToY(.7);
    promptScale.setInterpolator(promptAnimationInterpolator);

    TranslateTransition promptTranslate = new TranslateTransition(promptAnimationDuration, this.promptLabel);
    promptTranslate.setFromY(0);
    promptTranslate.setToY(-AnchorPane.getTopAnchor(this.promptLabel) - 4);
    promptTranslate.setInterpolator(promptAnimationInterpolator);

    this.promptLabel.translateXProperty().bind(
            this.promptLabel.widthProperty()
            .multiply(this.promptLabel.scaleXProperty()
                    .subtract(1)
                    .divide(2)));

    this.promptMoveAnimation = new ParallelTransition(promptScale, promptTranslate);

    this.promptUp = false;
}
项目:Elegit    文件:Highlighter.java   
/**
 * First requests the focus of the MatchedScrollPanes, then
 * sets the state of the given cell to emphasized, and fianlly
 * performs an animation on it. Currently, the animation is
 * a repeated scaling.
 * Cells being emphasized are blocked from other highlighting.
 * @param c the cell to emphasize
 */
public static void emphasizeCell(Cell c){
    if(!blockedCellIDs.contains(c.getCellId())){
        blockedCellIDs.add(c.getCellId());
    }

    Platform.runLater(() -> {
        CommitTreeScrollPane.scrollTo(c.rowLocationProperty.doubleValue());
        c.setCellState(CellState.EMPHASIZED);

        Shape s = (Shape) c.view;

        ScaleTransition sct = new ScaleTransition(Duration.millis(425), s);
        sct.setByX(0.3f);
        sct.setByY(0.3f);
        sct.setCycleCount(6);
        sct.setAutoReverse(true);

        c.view.setScaleX(1.0);
        c.view.setScaleY(1.0);

        sct.play();

        sct.setOnFinished(event -> endEmphasisOnCell(c));
    });
}
项目:mmorpg    文件:UIAnimations.java   
public SkillDamageAnimation(String dmgText, int x, int y) {
    Platform.runLater(() -> {
        Text text = new Text(dmgText);
        text.setFill(Color.AQUAMARINE);
        text.setFont(text.getFont().font(16));
        root.getChildren().add(text);
        TranslateTransition tt = new TranslateTransition(Duration.seconds(1.5), text);

        tt.setFromX(x);
        tt.setFromY(y);
        tt.setToX(x + GameMath.random(100) - 50);
        tt.setToY(y - GameMath.random(50));

        tt.setOnFinished(event -> {
            root.getChildren().remove(text);
        });

        ScaleTransition st = new ScaleTransition(Duration.seconds(0.75), text);
        st.setFromX(1);
        st.setToX(1.5);

        st.play();
        tt.play();
    });
}
项目:firstlight    文件:KnownWalletController.java   
private Animation createWalletHideAnimation() {
    try {
        FadeTransition fade = new FadeTransition(Duration.millis(1000), this.knownWalletDetailContainer);
        fade.setFromValue(1.0);
        fade.setToValue(0.0);
        fade.setCycleCount(1);

        ScaleTransition scale = new ScaleTransition(Duration.millis(1000), this.knownWalletDetailContainer);
        scale.setFromX(1.0);
        scale.setToX(0.1);
        scale.setFromY(1.0);
        scale.setToY(0.1);
        scale.setCycleCount(1);

        ParallelTransition parallel = new ParallelTransition();
        parallel.getChildren().addAll(fade, scale);
        parallel.setCycleCount(1);

        return parallel;        
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return null;
    }       
}
项目:firstlight    文件:KnownWalletController.java   
private Animation createWalletShowAnimation() {
    try {
        FadeTransition fade = new FadeTransition(Duration.millis(1000), this.knownWalletDetailContainer);
        fade.setFromValue(0.0);
        fade.setToValue(1.0);
        fade.setCycleCount(1);

        ScaleTransition scale = new ScaleTransition(Duration.millis(1000), this.knownWalletDetailContainer);
        scale.setFromX(0.1);
        scale.setToX(1.0);
        scale.setFromY(0.1);
        scale.setToY(1.0);
        scale.setCycleCount(1);

        ParallelTransition parallel = new ParallelTransition();
        parallel.getChildren().addAll(fade, scale);
        parallel.setCycleCount(1);

        return parallel;        
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return null;
    }       
}
项目:jointry    文件:FlipStmnt.java   
@Override
public Object eval(Environment env) {
    Sprite sprite = env.getSprite();
    SequentialTransition st = env.getSequentialTransition();
    ScaleTransition t = new ScaleTransition();

    int fromDirection = sprite.getDirection();
    t.setFromX(fromDirection);

    int toDirection = fromDirection * -1;
    t.setToX(toDirection);

     t.setNode(sprite);
     st.getChildren().add(t);

    sprite.setDirection(toDirection);
    return null;
}
项目:Coconut-IDE    文件:StartPresenter.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    propertyCollector = PropertyCollector.create();

    if (!propertyCollector.isJDKCorrect() && propertyCollector.getProperty("jdk") == null) {
        createProject.setDisable(true);
    }

    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(2000), coconutPng);
    scaleTransition.setToX(1.1f);
    scaleTransition.setToY(1.1f);
    scaleTransition.setCycleCount(Timeline.INDEFINITE);
    scaleTransition.setAutoReverse(true);
    scaleTransition.play();
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * Animates for the provided new tile(graphic).
 * @param graphic
 * @param duration 
 */
private void setNewTileAnimation(Label graphic, Duration duration) {
    FadeTransition fd = new FadeTransition(duration, graphic);
    fd.setFromValue(0);
    fd.setToValue(.001);
    fd.play();
    fd.setOnFinished(e-> {

        FadeTransition fd2 = new FadeTransition(Duration.seconds(.2), graphic);
        fd2.setFromValue(0.2);
        fd2.setToValue(1);
        fd2.play();

        ScaleTransition stt = new ScaleTransition(Duration.seconds(.2), graphic);
        stt.setFromX(.3);
        stt.setToX(1);
        stt.setFromY(.3);
        stt.setToY(1);
        stt.play();

        stt.setOnFinished(ee -> {
            int plus = convertToInt(graphic.getText());
            this.setNewScore(plus);
            setPlusScoreAnimation(String.valueOf(plus));
        });
    });
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * 
 * @param pp
 * @param node 
 */
private void popupOpener(Node node) {   
    ScaleTransition st = new ScaleTransition(Duration.seconds(.3), node);
    st.setFromX(.2);
    st.setFromY(.2);
    st.setToX(1);
    st.setToY(1);
    st.play();

    FadeTransition fd = new FadeTransition(Duration.seconds(.2), node);
    fd.setFromValue(.2);
    fd.setToValue(1);
    fd.play();
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * 
 * @param pp 
 */
private void popupCloser(Popup pp, Node node) {     
    ScaleTransition st = new ScaleTransition(Duration.seconds(.3), node);
    st.setToX(0);
    st.setToY(0);
    st.play();

    FadeTransition fd = new FadeTransition(Duration.seconds(.3), node);
    fd.setToValue(.2);
    fd.play();
    st.setOnFinished(e -> pp.hide());
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * 
 * @param b 
 */
public void buttonHovered(Button b) {
    ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
    st.setToX(1.6);
    st.setToY(1.6);
    st.play();      
}
项目:xpanderfx    文件:MainFXMLDocumentController.java   
/**
 * 
 * @param b 
 */
public void buttonHoveredOff(Button b) {
    ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
    st.setToX(1);
    st.setToY(1);
    st.play();              
}
项目:xpanderfx    文件:AboutFXMLDocumentController.java   
public void oakyButtonHandler(MouseEvent event, Popup pp) {
    ScaleTransition st = new ScaleTransition(Duration.seconds(.3), (Node) pp.getContent());
    st.setToX(0);
    st.play();

    FadeTransition fd = new FadeTransition(Duration.seconds(.3), (Node) pp.getContent());
    fd.setToValue(.2);
    st.setOnFinished(e -> pp.hide());
}
项目:util4j    文件:GameManager.java   
/**
 * Animation that creates a fade in effect when a tile is added to the game 
 * by increasing the tile scale from 0 to 100% 
 * @param tile to be animated
 * @return a scale transition 
 */
private ScaleTransition animateNewlyAddedTile(Tile tile) {
    final ScaleTransition scaleTransition = new ScaleTransition(ANIMATION_NEWLY_ADDED_TILE, tile);
    scaleTransition.setToX(1.0);
    scaleTransition.setToY(1.0);
    scaleTransition.setInterpolator(Interpolator.EASE_OUT);
    scaleTransition.setOnFinished(e -> {
        // after last movement on full grid, check if there are movements available
        if (this.gameGrid.values().parallelStream().noneMatch(Objects::isNull) && mergeMovementsAvailable() == 0 ) {
            board.setGameOver(true);
        }
    });
    return scaleTransition;
}
项目:util4j    文件:GameManager.java   
/**
 * Animation that creates a pop effect when two tiles merge
 * by increasing the tile scale to 120% at the middle, and then going back to 100% 
 * @param tile to be animated
 * @return a sequential transition 
 */
private SequentialTransition animateMergedTile(Tile tile) {
    final ScaleTransition scale0 = new ScaleTransition(ANIMATION_MERGED_TILE, tile);
    scale0.setToX(1.2);
    scale0.setToY(1.2);
    scale0.setInterpolator(Interpolator.EASE_IN);

    final ScaleTransition scale1 = new ScaleTransition(ANIMATION_MERGED_TILE, tile);
    scale1.setToX(1.0);
    scale1.setToY(1.0);
    scale1.setInterpolator(Interpolator.EASE_OUT);

    return new SequentialTransition(scale0, scale1);
}
项目:CalendarFX    文件:EntryViewBase.java   
/**
 * Makes the entry view "bounce" by applying a scale transition. This is a
 * good way to make an entry stand out, e.g. when it receives the keyboard
 * focus.
 */
public final void bounce() {
    ScaleTransition transition = new ScaleTransition(Duration.millis(200), this);
    setCache(true);
    setCacheHint(CacheHint.SCALE);
    transition.setAutoReverse(true);
    transition.setFromX(1);
    transition.setToX(.8);
    transition.setFromY(1);
    transition.setToY(.8);
    transition.setCycleCount(2);
    transition.setOnFinished(evt -> setCache(false));
    transition.play();
}
项目:graphing-loan-analyzer    文件:DatePickerSkin.java   
private AnimatedPopup() {

            showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
            showFadeTransition.setFromValue(0);
            showFadeTransition.setToValue(1);
            showFadeTransition.setInterpolator(new BackInterpolator());

            showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
            showScaleTransition.setFromX(0.8);
            showScaleTransition.setFromY(0.8);
            showScaleTransition.setToY(1);
            showScaleTransition.setToX(1);

            showScaleTransition.setInterpolator(new BackInterpolator());

            hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
            hideFadeTransition.setFromValue(1);
            hideFadeTransition.setToValue(0);
            hideFadeTransition.setInterpolator(new BackInterpolator());

            hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
            hideScaleTransition.setFromX(1);
            hideScaleTransition.setFromY(1);
            hideScaleTransition.setToY(0.8);
            hideScaleTransition.setToX(0.8);

            hideScaleTransition.setInterpolator(new BackInterpolator());
            hideScaleTransition.setOnFinished(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    if (AnimatedPopup.super.isShowing()) {
                        AnimatedPopup.super.hide();
                    }
                }
            });
        }
项目:LCL    文件:ZoomTransition.java   
private static void zoom(Node node, double scaleFrom, double scaleTo, double opacity, EventHandler<ActionEvent> eventHandler) {
    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(200), node);
    scaleTransition.setToX(scaleTo);
    scaleTransition.setToY(scaleTo);
    scaleTransition.setFromX(scaleFrom);
    scaleTransition.setFromY(scaleFrom);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(200), node);
    fadeTransition.setFromValue(opacity);
    fadeTransition.setToValue(1D - opacity);
    ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
    parallelTransition.play();
    parallelTransition.setOnFinished(eventHandler);
}
项目:javaone2016    文件:ImageViewLayer.java   
/** {@inheritDoc} */
@Override public void layoutChildren() {
    final boolean wasShowing = imageView.isVisible();
    final boolean isShowing = isShowing();

    imageView.setVisible(isShowing);
    if (!isShowing) {
        return;
    }

    final double glassPaneWidth = snapSize(glassPane.getWidth());
    final double glassPaneHeight = snapSize(glassPane.getHeight());

    final double imageWidth = imageView.getLayoutBounds().getWidth();
    final double imageHeight = imageView.getLayoutBounds().getHeight();

    imageView.relocate(glassPaneWidth / 2.0 - imageWidth / 2.0, glassPaneHeight / 2.0 - imageHeight / 2.0);

    if (!wasShowing && isShowing) {
        ScaleTransition st = new ScaleTransition(Duration.millis(250), imageView);
        st.setByX(1.0f);
        st.setByY(1.0f);
        st.setCycleCount(1);
        st.setAutoReverse(true);
        st.play();
    }
}
项目:FakeImageDetection    文件:LaunchScreeenController.java   
private void startSimpleMetaDataAnimation() {
    float animationExtension = 3.25f;
    bulgingTransition = new ScaleTransition(Duration.millis(1000), load_image_button);
    bulgingTransition.setToX(animationExtension);
    bulgingTransition.setToY(animationExtension);
    bulgingTransition.autoReverseProperty().setValue(true);
    bulgingTransition.setCycleCount(2);
    bulgingTransition.play();
    load_image_button.setFont(Font.font("Roboto", FontWeight.NORMAL, 8));
    load_image_button.setText("Checking Metadata..");

}
项目:FakeImageDetection    文件:NeuralnetInterfaceController.java   
private void startAnimation() {
    navigation_button.setText("Applying ELA on Image");
    float animationExtension = 1.2f;
    bulgingTransition = new ScaleTransition(Duration.millis(2000), navigation_button);
    bulgingTransition.setToX(animationExtension);
    bulgingTransition.setToY(animationExtension);
    bulgingTransition.autoReverseProperty().setValue(true);
    bulgingTransition.setCycleCount(bulgingTransition.INDEFINITE);
    bulgingTransition.play();
}
项目:Simulizer    文件:InternalWindow.java   
/** Called when all internal window stuff is done */
public void ready() {
    ScaleTransition sc = new ScaleTransition(Duration.millis(250), this);
    sc.setToX(1);
    sc.setToY(1);
    Platform.runLater(sc::playFromStart);
}
项目:viskell    文件:FunctionMenu.java   
/** Closes this menu by removing it from it's parent. */
public void close(boolean byMouse) {
    // disable it first, before removal in a closing animation 
    this.setMouseTransparent(true);
    ScaleTransition closing = new ScaleTransition(byMouse ? Duration.ONE :Duration.millis(300), this);
    closing.setToX(0.3);
    closing.setToY(0.1);
    closing.setOnFinished(e -> parent.removeMenu(this));
    closing.play();
}
项目:metastone    文件:JoustToken.java   
public JoustToken(GameBoardView boardView, Card card, boolean up, boolean won) {
    Window parent = boardView.getScene().getWindow();
    this.cardToken = new CardTooltip();

    popup = new Popup();
    popup.getContent().setAll(cardToken);
    popup.setX(parent.getX() + 600);
    popup.show(parent);
    int offsetY = up ? -200 : 100;
    popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5 + offsetY);

    cardToken.setCard(card);

    NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
    FadeTransition animation = new FadeTransition(Duration.seconds(1.0), cardToken);
    animation.setDelay(Duration.seconds(1f));
    animation.setOnFinished(this::onComplete);
    animation.setFromValue(1);
    animation.setToValue(0);
    animation.play();

    if (won) {
        ScaleTransition scaleAnimation = new ScaleTransition(Duration.seconds(0.5f), cardToken);
        scaleAnimation.setByX(0.1);
        scaleAnimation.setByY(0.1);
        scaleAnimation.setCycleCount(2);
        scaleAnimation.setAutoReverse(true);
        scaleAnimation.play();  
    }
}
项目:Tourney    文件:MaterialTextField.java   
private void initializeUnderlineAnimation() {
    ScaleTransition scaleX = new ScaleTransition(underlineAnimationDuration, this.activeUnderline);
    scaleX.setFromX(0);
    scaleX.setToX(1);
    scaleX.setInterpolator(underlineAnimationInterpolator);
    FadeTransition fade = new FadeTransition(underlineAnimationDuration, this.activeUnderline);
    fade.setFromValue(0);
    fade.setToValue(1);
    this.underlineAnimation = new ParallelTransition(scaleX, fade);
}
项目:Game2048FX    文件:GameManager.java   
/**
 * Animation that creates a fade in effect when a tile is added to the game 
 * by increasing the tile scale from 0 to 100% 
 * @param tile to be animated
 * @return a scale transition 
 */
private ScaleTransition animateNewlyAddedTile(Tile tile) {
    final ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(125), tile);
    scaleTransition.setToX(1.0);
    scaleTransition.setToY(1.0);
    scaleTransition.setInterpolator(Interpolator.EASE_OUT);
    scaleTransition.setOnFinished(e -> {
        // after last movement on full grid, check if there are movements available
        if (checkEndGame()) {
            board.setGameOver(true);
        }
    });
    return scaleTransition;
}