Search in sources :

Example 41 with KeyFrame

use of javafx.animation.KeyFrame in project arquivoProject by fader-azevedo.

the class PaginaInicialController method listaTodasPastas.

@FXML
private void listaTodasPastas() throws IOException {
    Timeline timeline = new Timeline(new KeyFrame(Duration.millis(250), ev -> {
        try {
            btnInicio.getStyleClass().clear();
            btnEstante.getStyleClass().clear();
            btnPratileira.getStyleClass().clear();
            btnPasta.getStyleClass().add("butCriar");
            btnPauta.getStyleClass().clear();
            btnRegistar.getStyleClass().clear();
            btnRegistar.getStyleClass().add("begin");
            pnInicio.toFront();
            pnPesquisa.getChildren().clear();
            FXMLLoader fxmlLoader = new FXMLLoader();
            fxmlLoader.load(getClass().getResource("/view/ListaPasta.fxml").openStream());
            AnchorPane root = fxmlLoader.getRoot();
            ListaPastaController listPastCont = fxmlLoader.getController();
            listPastCont.scrollBtnPasta("", "");
            pnInicio.getChildren().clear();
            pnInicio.getChildren().add(root);
        } catch (Exception e) {
        }
    }));
    timeline.play();
}
Also used : JFXButton(com.jfoenix.controls.JFXButton) KeyFrame(javafx.animation.KeyFrame) Initializable(javafx.fxml.Initializable) MenuItem(javafx.scene.control.MenuItem) URL(java.net.URL) Timeline(javafx.animation.Timeline) IOException(java.io.IOException) Logger(java.util.logging.Logger) Level(java.util.logging.Level) FXML(javafx.fxml.FXML) Parent(javafx.scene.Parent) ActionEvent(javafx.event.ActionEvent) Duration(javafx.util.Duration) ResourceBundle(java.util.ResourceBundle) AnchorPane(javafx.scene.layout.AnchorPane) FXMLLoader(javafx.fxml.FXMLLoader) MenuButton(javafx.scene.control.MenuButton) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) JFXTextField(com.jfoenix.controls.JFXTextField) Pane(javafx.scene.layout.Pane) Timeline(javafx.animation.Timeline) KeyFrame(javafx.animation.KeyFrame) FXMLLoader(javafx.fxml.FXMLLoader) AnchorPane(javafx.scene.layout.AnchorPane) IOException(java.io.IOException) FXML(javafx.fxml.FXML)

Example 42 with KeyFrame

use of javafx.animation.KeyFrame in project arquivoProject by fader-azevedo.

the class PaginaInicialController method criarEstantePane.

private void criarEstantePane() {
    Timeline timeline = new Timeline(new KeyFrame(Duration.millis(250), ev -> {
        try {
            btnInicio.getStyleClass().clear();
            btnEstante.getStyleClass().clear();
            btnPratileira.getStyleClass().clear();
            btnPasta.getStyleClass().clear();
            btnPauta.getStyleClass().clear();
            btnRegistar.getStyleClass().add("butCriar");
            pnInicio.getChildren().clear();
            pnPesquisa.getChildren().clear();
            pnCarregador.toFront();
            FXMLLoader fxmlLoader = new FXMLLoader();
            fxmlLoader.load(getClass().getResource("/view/CriarEstante.fxml").openStream());
            AnchorPane root = fxmlLoader.getRoot();
            pnCarregador.getChildren().clear();
            pnCarregador.getChildren().add(root);
        } catch (IOException ex) {
            Logger.getLogger(PaginaInicialController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }));
    timeline.play();
}
Also used : JFXButton(com.jfoenix.controls.JFXButton) KeyFrame(javafx.animation.KeyFrame) Initializable(javafx.fxml.Initializable) MenuItem(javafx.scene.control.MenuItem) URL(java.net.URL) Timeline(javafx.animation.Timeline) IOException(java.io.IOException) Logger(java.util.logging.Logger) Level(java.util.logging.Level) FXML(javafx.fxml.FXML) Parent(javafx.scene.Parent) ActionEvent(javafx.event.ActionEvent) Duration(javafx.util.Duration) ResourceBundle(java.util.ResourceBundle) AnchorPane(javafx.scene.layout.AnchorPane) FXMLLoader(javafx.fxml.FXMLLoader) MenuButton(javafx.scene.control.MenuButton) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) JFXTextField(com.jfoenix.controls.JFXTextField) Pane(javafx.scene.layout.Pane) Timeline(javafx.animation.Timeline) KeyFrame(javafx.animation.KeyFrame) IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader) AnchorPane(javafx.scene.layout.AnchorPane)

Example 43 with KeyFrame

use of javafx.animation.KeyFrame in project arquivoProject by fader-azevedo.

the class PaginaInicialController method criarPratileiraPane.

private void criarPratileiraPane() {
    Timeline timeline = new Timeline(new KeyFrame(Duration.millis(250), ev -> {
        try {
            btnInicio.getStyleClass().clear();
            btnEstante.getStyleClass().clear();
            btnPratileira.getStyleClass().clear();
            btnPasta.getStyleClass().clear();
            btnPauta.getStyleClass().clear();
            btnRegistar.getStyleClass().add("butCriar");
            pnInicio.getChildren().clear();
            pnPesquisa.getChildren().clear();
            pnCarregador.toFront();
            Parent root = FXMLLoader.load(getClass().getResource("/view/CriarPratileira.fxml"));
            pnCarregador.getChildren().clear();
            pnCarregador.getChildren().add(root);
        } catch (IOException ex) {
            Logger.getLogger(PaginaInicialController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }));
    timeline.play();
}
Also used : JFXButton(com.jfoenix.controls.JFXButton) KeyFrame(javafx.animation.KeyFrame) Initializable(javafx.fxml.Initializable) MenuItem(javafx.scene.control.MenuItem) URL(java.net.URL) Timeline(javafx.animation.Timeline) IOException(java.io.IOException) Logger(java.util.logging.Logger) Level(java.util.logging.Level) FXML(javafx.fxml.FXML) Parent(javafx.scene.Parent) ActionEvent(javafx.event.ActionEvent) Duration(javafx.util.Duration) ResourceBundle(java.util.ResourceBundle) AnchorPane(javafx.scene.layout.AnchorPane) FXMLLoader(javafx.fxml.FXMLLoader) MenuButton(javafx.scene.control.MenuButton) ObservableValue(javafx.beans.value.ObservableValue) ChangeListener(javafx.beans.value.ChangeListener) JFXTextField(com.jfoenix.controls.JFXTextField) Pane(javafx.scene.layout.Pane) Timeline(javafx.animation.Timeline) Parent(javafx.scene.Parent) KeyFrame(javafx.animation.KeyFrame) IOException(java.io.IOException)

Example 44 with KeyFrame

use of javafx.animation.KeyFrame in project bisq-desktop by bisq-network.

the class Transitions method blur.

public void blur(Node node, int duration, double brightness, boolean removeNode, double blurRadius) {
    if (removeEffectTimeLine != null)
        removeEffectTimeLine.stop();
    node.setMouseTransparent(true);
    GaussianBlur blur = new GaussianBlur(0.0);
    Timeline timeline = new Timeline();
    KeyValue kv1 = new KeyValue(blur.radiusProperty(), blurRadius);
    KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1);
    ColorAdjust darken = new ColorAdjust();
    darken.setBrightness(0.0);
    blur.setInput(darken);
    KeyValue kv2 = new KeyValue(darken.brightnessProperty(), brightness);
    KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
    timeline.getKeyFrames().addAll(kf1, kf2);
    node.setEffect(blur);
    if (removeNode)
        timeline.setOnFinished(actionEvent -> UserThread.execute(() -> ((Pane) (node.getParent())).getChildren().remove(node)));
    timeline.play();
}
Also used : EventHandler(javafx.event.EventHandler) KeyFrame(javafx.animation.KeyFrame) Node(javafx.scene.Node) ColorAdjust(javafx.scene.effect.ColorAdjust) Timeline(javafx.animation.Timeline) Inject(javax.inject.Inject) ActionEvent(javafx.event.ActionEvent) Duration(javafx.util.Duration) FadeTransition(javafx.animation.FadeTransition) Interpolator(javafx.animation.Interpolator) Preferences(bisq.core.user.Preferences) UserThread(bisq.common.UserThread) KeyValue(javafx.animation.KeyValue) GaussianBlur(javafx.scene.effect.GaussianBlur) Pane(javafx.scene.layout.Pane) Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) GaussianBlur(javafx.scene.effect.GaussianBlur) KeyFrame(javafx.animation.KeyFrame) ColorAdjust(javafx.scene.effect.ColorAdjust) Pane(javafx.scene.layout.Pane)

Example 45 with KeyFrame

use of javafx.animation.KeyFrame in project Board-Instrumentation-Framework by intel.

the class DynamicTransition method cube.

/**
 * Cube transition between front- and backimage
 *
 * @param FRONT_IMAGE
 * @param BACK_IMAGE
 * @param INTERPOLATOR spline that is used for the animation
 * @param DURATION oneSecond for the transition
 * @param DELAY delay in milliseconds between each tile animation
 */
private void cube(final Image FRONT_IMAGE, final Image BACK_IMAGE, final Interpolator INTERPOLATOR, final Duration DURATION, final int DELAY) {
    adjustTilesVisibility(1);
    viewPorts.clear();
    final Rectangle2D VIEW_PORT = new Rectangle2D(0, 0, FRONT_IMAGE.getWidth(), FRONT_IMAGE.getHeight());
    for (int i = 0; i < (noOfTilesX * noOfTilesY); i++) {
        imageViewsFront.get(i).setViewport(VIEW_PORT);
        imageViewsBack.get(i).setViewport(VIEW_PORT);
    }
    imageViewsFront.get(0).setImage(FRONT_IMAGE);
    imageViewsBack.get(0).setImage(BACK_IMAGE);
    imageViewsFront.get(0).setTranslateZ(-0.5 * FRONT_IMAGE.getWidth());
    imageViewsBack.get(0).setTranslateX(0.5 * FRONT_IMAGE.getWidth());
    imageViewsBack.get(0).setRotationAxis(Rotate.Y_AXIS);
    // imageViewsBack.get(0).setRotate(90);
    // to grid would be reversed if didn't do this
    imageViewsBack.get(0).setRotate(270);
    Rotate rotateY = new Rotate(0, Rotate.Y_AXIS);
    rotateY.setPivotX(FRONT_IMAGE.getWidth() * 0.5);
    rotateY.setPivotZ(FRONT_IMAGE.getWidth() * 0.5);
    rotateY.angleProperty().addListener((ov, oldAngle, newAngle) -> {
        if (73 < newAngle.intValue()) {
            imageViewsBack.get(0).toFront();
        }
    });
    Translate translateZ = new Translate(0, 0, FRONT_IMAGE.getWidth() * 0.5);
    tiles.get(0).getTransforms().setAll(rotateY, translateZ);
    KeyValue kvRotateBegin = new KeyValue(rotateY.angleProperty(), 0, INTERPOLATOR);
    KeyValue kvRotateEnd = new KeyValue(rotateY.angleProperty(), 90, INTERPOLATOR);
    KeyValue kvOpacityFrontBegin = new KeyValue(imageViewsFront.get(0).opacityProperty(), 1.0, INTERPOLATOR);
    KeyValue kvOpacityBackBegin = new KeyValue(imageViewsBack.get(0).opacityProperty(), 0.0, INTERPOLATOR);
    KeyValue kvScaleXBegin = new KeyValue(tiles.get(0).scaleXProperty(), 1.0, INTERPOLATOR);
    KeyValue kvScaleYBegin = new KeyValue(tiles.get(0).scaleYProperty(), 1.0, INTERPOLATOR);
    KeyValue kvScaleXMiddle = new KeyValue(tiles.get(0).scaleXProperty(), 0.85, INTERPOLATOR);
    KeyValue kvScaleYMiddle = new KeyValue(tiles.get(0).scaleYProperty(), 0.85, INTERPOLATOR);
    KeyValue kvOpacityFrontMiddle = new KeyValue(imageViewsFront.get(0).opacityProperty(), 1.0, INTERPOLATOR);
    KeyValue kvOpacityBackMiddle = new KeyValue(imageViewsBack.get(0).opacityProperty(), 1.0, INTERPOLATOR);
    KeyValue kvScaleXEnd = new KeyValue(tiles.get(0).scaleXProperty(), 1.0, INTERPOLATOR);
    KeyValue kvScaleYEnd = new KeyValue(tiles.get(0).scaleYProperty(), 1.0, INTERPOLATOR);
    KeyValue kvOpacityFrontEnd = new KeyValue(imageViewsFront.get(0).opacityProperty(), 0.0, INTERPOLATOR);
    KeyValue kvOpacityBackEnd = new KeyValue(imageViewsBack.get(0).opacityProperty(), 1.0, INTERPOLATOR);
    KeyFrame kf0 = new KeyFrame(Duration.ZERO, kvRotateBegin, kvScaleXBegin, kvScaleYBegin, kvOpacityFrontBegin, kvOpacityBackBegin);
    KeyFrame kf1 = new KeyFrame(DURATION.multiply(0.5), kvScaleXMiddle, kvScaleYMiddle, kvOpacityFrontMiddle, kvOpacityBackMiddle);
    KeyFrame kf2 = new KeyFrame(DURATION, kvRotateEnd, kvScaleXEnd, kvScaleYEnd, kvOpacityFrontEnd, kvOpacityBackEnd);
    timelines.get(0).setDelay(Duration.millis(DELAY));
    timelines.get(0).getKeyFrames().setAll(kf0, kf1, kf2);
    // Listen for the last timeline to finish and switch the images
    timelines.get(0).setOnFinished(observable -> transitionFinished());
}
Also used : KeyValue(javafx.animation.KeyValue) Rotate(javafx.scene.transform.Rotate) Rectangle2D(javafx.geometry.Rectangle2D) KeyFrame(javafx.animation.KeyFrame) Translate(javafx.scene.transform.Translate)

Aggregations

KeyFrame (javafx.animation.KeyFrame)232 Timeline (javafx.animation.Timeline)197 KeyValue (javafx.animation.KeyValue)150 ActionEvent (javafx.event.ActionEvent)66 FXML (javafx.fxml.FXML)54 Duration (javafx.util.Duration)48 EventHandler (javafx.event.EventHandler)43 Stage (javafx.stage.Stage)40 Alert (javafx.scene.control.Alert)35 Rotate (javafx.scene.transform.Rotate)26 IOException (java.io.IOException)25 URL (java.net.URL)24 ResourceBundle (java.util.ResourceBundle)24 Initializable (javafx.fxml.Initializable)23 Interpolator (javafx.animation.Interpolator)22 JFXButton (com.jfoenix.controls.JFXButton)21 FXMLLoader (javafx.fxml.FXMLLoader)21 MouseEvent (javafx.scene.input.MouseEvent)18 Pane (javafx.scene.layout.Pane)18 Node (javafx.scene.Node)17