public ActionTextPane() { actionText = new Label("Test"); graphic = new ImageView(new Image("assets/icons/editor_action_info_icon.png")); actionText.setGraphic(graphic); actionText.setTextFill(Utils.getDefaultTextColor()); actionText.setAlignment(Pos.CENTER); actionText.setPadding(new Insets(0, 0, 0, 5)); getChildren().add(actionText); setAlignment(Pos.CENTER); ft = new FadeTransition(Duration.millis(500), graphic); ft.setFromValue(1.0); ft.setToValue(0.0); ft.setAutoReverse(true); ft.setCycleCount(4); }
@Override protected void dataItemRemoved(Data<Number, Number> item, Series<Number, Number> series) { final Node candle = item.getNode(); if (shouldAnimate()) { // fade out old candle FadeTransition ft = new FadeTransition(Duration.millis(500), candle); ft.setToValue(0); ft.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { getPlotChildren().remove(candle); } }); ft.play(); } else { getPlotChildren().remove(candle); } }
private void showSplash(final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler) { progressText.textProperty().bind(task.messageProperty()); loadProgress.progressProperty().bind(task.progressProperty()); task.stateProperty().addListener((observableValue, oldState, newState) -> { if (newState == Worker.State.SUCCEEDED) { loadProgress.progressProperty().unbind(); loadProgress.setProgress(1); initStage.toFront(); FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout); fadeSplash.setFromValue(1.0); fadeSplash.setToValue(0.0); fadeSplash.setOnFinished(actionEvent -> initStage.hide()); fadeSplash.play(); initCompletionHandler.complete(); } }); Scene splashScene = new Scene(splashLayout); initStage.initStyle(StageStyle.UNDECORATED); final Rectangle2D bounds = Screen.getPrimary().getBounds(); initStage.setScene(splashScene); initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2); initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2); initStage.show(); }
private void onActionSimulateGameMode(EGameMode gameMode) { DebugConsole.getDefault().debug(this.getClass(), "On Action simulate GameMode: " + gameMode.toString()); // NOI18N final SequentialTransition st = new SequentialTransition(); st.setDelay(Duration.millis(125.0d)); final PauseTransition ptStopGameMode = this.onActionStopGameMode(); st.getChildren().add(ptStopGameMode); final FadeTransition ftHideGameInformations = this.onActionHideGameInformations(); st.getChildren().add(ftHideGameInformations); final FadeTransition ftShowGameInformations = this.onActionShowGameInformations(gameMode); st.getChildren().add(ftShowGameInformations); final PauseTransition ptStartGameMode = this.onActionStartGameMode(gameMode); st.getChildren().add(ptStartGameMode); st.playFromStart(); }
@Override public void start(Stage primaryStage) { if (primaryStage == null) { return; } Group group = new Group(); Rectangle rect = new Rectangle(20,20,200,200); FadeTransition ft = new FadeTransition(Duration.millis(5000), rect); ft.setFromValue(1.0); ft.setToValue(0.0); ft.play(); group.getChildren().add(rect); Scene scene = new Scene(group, 300, 200); primaryStage.setScene(scene); primaryStage.show(); }
@Override protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) { Node candle = createCandle(getData().indexOf(series), item, itemIndex); if (shouldAnimate()) { candle.setOpacity(0); getPlotChildren().add(candle); // fade in new candle FadeTransition ft = new FadeTransition(Duration.millis(500), candle); ft.setToValue(1); ft.play(); } else { getPlotChildren().add(candle); } // always draw average line on top if (series.getNode() != null) { series.getNode().toFront(); } }
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) { // handle any data already in series for (int j = 0; j < series.getData().size(); j++) { Data item = series.getData().get(j); Node candle = createCandle(seriesIndex, item, j); if (shouldAnimate()) { candle.setOpacity(0); getPlotChildren().add(candle); // fade in new candle FadeTransition ft = new FadeTransition(Duration.millis(500), candle); ft.setToValue(1); ft.play(); } else { getPlotChildren().add(candle); } } // create series path Path seriesPath = new Path(); seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex); series.setNode(seriesPath); getPlotChildren().add(seriesPath); }
@Override protected void seriesRemoved(Series<Number, Number> series) { // remove all candle nodes for (XYChart.Data<Number, Number> d : series.getData()) { final Node candle = d.getNode(); if (shouldAnimate()) { // fade out old candle FadeTransition ft = new FadeTransition(Duration.millis(500), candle); ft.setToValue(0); ft.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { getPlotChildren().remove(candle); } }); ft.play(); } else { getPlotChildren().remove(candle); } } }
/** * Método de efeito de transição de saída */ private void makeFadeOut(String path) { FadeTransition fadeTransition = new FadeTransition(); fadeTransition.setDuration(Duration.millis(250)); fadeTransition.setNode(rootPane); fadeTransition.setFromValue(1); fadeTransition.setToValue(0); fadeTransition.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { loadScreenPlay(path); } catch (IOException ex) { Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex); } } }); fadeTransition.play(); }
/** * Método que inicia a view Inicial (MENU) e aplica estilos CSS nos botões */ @Autor("Divino Matheus") private void makeFadeOut(String path) { FadeTransition fadeTransition = new FadeTransition(); fadeTransition.setDuration(Duration.millis(250)); fadeTransition.setNode(rootPane); fadeTransition.setFromValue(1); fadeTransition.setToValue(0); fadeTransition.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { loadScreenPlay(path); } catch (IOException ex) { Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex); } } }); fadeTransition.play(); }
private void makeFadeOut(String path) { FadeTransition fadeTransition = new FadeTransition(); fadeTransition.setDuration(Duration.millis(250)); fadeTransition.setNode(rootPane); fadeTransition.setFromValue(1); fadeTransition.setToValue(0); fadeTransition.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { loadScreenPlay(path); } catch (IOException ex) { Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex); } } }); fadeTransition.play(); }
/** * Método para efeito de transição de saída */ private void makeFadeOut(String path) { FadeTransition fadeTransition = new FadeTransition(); fadeTransition.setDuration(Duration.millis(250)); fadeTransition.setNode(rootPane); fadeTransition.setFromValue(1); fadeTransition.setToValue(0); fadeTransition.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { loadScreenPlay(path); } catch (IOException ex) { Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex); } } }); fadeTransition.play(); }
/** * Animates a label with the plus(new additional value) text. * @param plus */ private void setPlusScoreAnimation(String plus) { if(plus.length() > 2 ) { double width = 25 * plus.length(); PLUS_SCORE.setMinSize(width, 45); } PLUS_SCORE.setText("+" + plus); this.setScoreStyle(); PLUS_SCORE.setTextFill(Color.WHITE); FadeTransition ft = new FadeTransition(Duration.seconds(.7), PLUS_SCORE); ft.setFromValue(1); ft.setToValue(0); ft.play(); TranslateTransition tt = new TranslateTransition(Duration.seconds(.7), PLUS_SCORE); tt.setFromX(55); tt.setFromY(-50); tt.setToY(50); tt.play(); }
/** * * @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()); }
/** * * @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)); } }
/** * 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(); }
@Override public void handleStateChangeNotification(StateChangeNotification evt) { if (evt.getType() == StateChangeNotification.Type.BEFORE_START) { if (stage.isShowing()) { // fade out, hide stage at the end of animation final FadeTransition fadeTransition = new FadeTransition( Duration.millis(1000), stage.getScene().getRoot()); fadeTransition.setFromValue(1.0); fadeTransition.setToValue(0.0); final EventHandler<ActionEvent> eventHandler = t -> stage.hide(); fadeTransition.setOnFinished(eventHandler); fadeTransition.play(); } else { stage.hide(); } } }
/** @inheritDoc */ @Override protected void dataItemRemoved(final Data<X, Y> item, final MultiAxisChart.Series<X, Y> series) { final Node symbol = item.getNode(); if (symbol != null) { symbol.focusTraversableProperty().unbind(); } if (shouldAnimate()) { // fade out old symbol FadeTransition ft = new FadeTransition(Duration.millis(500), symbol); ft.setToValue(0); ft.setOnFinished(actionEvent -> { getPlotChildren().remove(symbol); removeDataItemFromDisplay(series, item); symbol.setOpacity(1.0); }); ft.play(); } else { getPlotChildren().remove(symbol); removeDataItemFromDisplay(series, item); } }
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); }
private void onActionNextRandomMap() { LoggerFacade.INSTANCE.debug(this.getClass(), "On action next random Map"); // NOI18N final int randomMapIndex = MapFacade.INSTANCE.getRandomMapIndex(); final MapModel mm = MapFacade.INSTANCE.loadMap(randomMapIndex); this.printMapToConsole(mm); vbRandomMap.getChildren().clear(); vbRandomMap.setOpacity(0.0d); vbRandomMap.getChildren().add(this.getLabel("Map: " + randomMapIndex)); // NOI18N vbRandomMap.getChildren().add(this.getLabel("")); // NOI18N final ObservableList<String> map = mm.getMapAsStrings(); map.stream().forEach(line -> { vbRandomMap.getChildren().add(this.getLabel(line)); }); final FadeTransition ftShowNextRandomMap = new FadeTransition(); ftShowNextRandomMap.setDuration(Duration.millis(550.0d)); ftShowNextRandomMap.setFromValue(0.0d); ftShowNextRandomMap.setToValue(1.0d); ftShowNextRandomMap.setNode(vbRandomMap); ftShowNextRandomMap.playFromStart(); }
private void showViewPreview() { LoggerFacade.INSTANCE.debug(this.getClass(), "Show view Preview"); // NOI18N final PreviewView view = new PreviewView(); final PreviewPresenter presenter = view.getRealPresenter(); presenter.registerActions(); final Parent preview = view.getView(); preview.setOpacity(0.0d); bpGameArea.setCenter(preview); final FadeTransition ftHidePreviewView = new FadeTransition(); ftHidePreviewView.setDelay(Duration.millis(250.0d)); ftHidePreviewView.setDuration(Duration.millis(375.0d)); ftHidePreviewView.setFromValue(0.0d); ftHidePreviewView.setToValue(1.0d); ftHidePreviewView.setNode(preview); ftHidePreviewView.playFromStart(); }
private void TransitionAlert(Pane player_pane, Pane energy_pane) { Rectangle rectangle = new Rectangle(150, 50); Stop[] stops = new Stop[]{new Stop(0, Color.RED), new Stop(1, Color.WHITE)}; LinearGradient gp = new LinearGradient(0, 0, 10, 24, true, CycleMethod.NO_CYCLE, stops); rectangle.setFill(gp); rectangle.setArcHeight(18); rectangle.setArcWidth(18); rectangle.setLayoutX(energy_pane.getLayoutX()); rectangle.setLayoutY(energy_pane.getLayoutY()); FadeTransition fadeTransition1 = new FadeTransition(Duration.millis(500), rectangle); fadeTransition1.setFromValue(0f); fadeTransition1.setToValue(0.6f); fadeTransition1.setCycleCount(2); fadeTransition1.setAutoReverse(true); player_pane.getChildren().add(rectangle); fadeTransition1.play(); }
private void TransitionGainPV(Pane player_pane, Pane energy_pane) { Rectangle rectangle = new Rectangle(150, 50); Stop[] stops = new Stop[]{new Stop(0, Color.GREEN), new Stop(1, Color.WHITE)}; LinearGradient gp = new LinearGradient(0, 0, 10, 24, true, CycleMethod.NO_CYCLE, stops); rectangle.setFill(gp); rectangle.setArcHeight(18); rectangle.setArcWidth(18); rectangle.setLayoutX(energy_pane.getLayoutX()); rectangle.setLayoutY(energy_pane.getLayoutY()); FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), rectangle); fadeTransition.setFromValue(0f); fadeTransition.setToValue(0.6f); fadeTransition.setCycleCount(2); fadeTransition.setAutoReverse(true); player_pane.getChildren().add(rectangle); fadeTransition.play(); }
private void TransitionForAll(Rectangle rectangle, double layoutXFrom, double layoutXTo, double layoutYFrom, double layoutYTo) { mainPane.getChildren().add(rectangle); TranslateTransition translateTransition = new TranslateTransition(Duration.millis(800), rectangle); translateTransition.setFromX(layoutXFrom); translateTransition.setToX(layoutXTo); translateTransition.setFromY(layoutYFrom); translateTransition.setToY(layoutYTo); translateTransition.setCycleCount(1); translateTransition.setAutoReverse(true); FadeTransition fadeTransition = new FadeTransition(Duration.millis(800), rectangle); fadeTransition.setFromValue(1.0f); fadeTransition.setToValue(0f); fadeTransition.setCycleCount(1); fadeTransition.setAutoReverse(true); translateTransition.play(); fadeTransition.play(); rectangle.setDisable(true); Rectangle newRectangle = new Rectangle(10, 10); eventExit(rectangle, newRectangle); }
private void initGraphics() { font = Font.font(0.4 * PREFERRED_HEIGHT); text = new Text(getSkinnable().getText()); text.setFont(font); text.setFill(getSkinnable().getTextColor()); thumb = new Rectangle(); thumb.setFill(getSkinnable().getThumbColor()); thumb.setOpacity(0.0); thumb.setMouseTransparent(true); pressed = new FadeTransition(Duration.millis(100), thumb); pressed.setInterpolator(Interpolator.EASE_IN); pressed.setFromValue(0.0); pressed.setToValue(0.8); released = new FadeTransition(Duration.millis(250), thumb); released.setInterpolator(Interpolator.EASE_OUT); released.setFromValue(0.8); released.setToValue(0.0); pane = new Pane(thumb, text); getChildren().setAll(pane); }
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(); }
private void switchStateAnimation(TDDState newState){ RotateTransition rotateTransition = new RotateTransition(Duration.millis(800), cycleImage); rotateTransition.setFromAngle(0); rotateTransition.setToAngle(-180); FadeTransition ft = new FadeTransition(Duration.millis(800), cycleImage); ft.setFromValue(1); ft.setToValue(0); RotateTransition rotateTransition2 = new RotateTransition(Duration.millis(800), cycleImageOverlay); rotateTransition2.setFromAngle(180); rotateTransition2.setToAngle(0); Image newImg = getImageOfPhase(newState); rotateTransition2.setOnFinished(event -> { cycleImage.setImage(newImg); }); FadeTransition ft2 = new FadeTransition(Duration.millis(800), cycleImageOverlay); ft2.setFromValue(0); ft2.setToValue(1); ft.play(); cycleImageOverlay.setImage(newImg); rotateTransition.play(); ft.play(); ft2.play(); rotateTransition2.play(); }
@Override public void deleteSection(int sectionId) { for(SectionView section : this.sections) { if(section.gameId == sectionId) { FadeTransition fadeTransition = new FadeTransition(Duration.seconds(7), section); fadeTransition.setFromValue(0.6); fadeTransition.setToValue(0); fadeTransition.play(); fadeTransition.setOnFinished(event -> { ConcreteLineView.this.getChildren().remove(section); fadeTransition.setNode(null); }); this.sections.remove(section); break; } } }
/** * set a screen by string id * * @param name */ public void setScreen(String name) { // dont try to set new screen if (screens.get(name) == null) { System.out.println("invalid screen"); return; } // fade out animation if (screen != null) { FadeTransition ft = new FadeTransition(new Duration(500), screen.getScene().getRoot()); ft.setFromValue(1); ft.setToValue(0); ft.play(); ticking = false; ft.setOnFinished(e -> { fadeIn(name); }); } else { fadeIn(name); } }
public void showNotification(String text) { labelNotification.setText(text); labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_NOTIFICATION)); FadeTransition fadeIn = new FadeTransition(Duration.millis(200), labelNotification); fadeIn.setFromValue(0.0); fadeIn.setToValue(1.0); FadeTransition fadeOut = new FadeTransition(Duration.millis(400), labelNotification); fadeOut.setFromValue(1.0); fadeOut.setToValue(0.0); fadeOut.setDelay(Duration.millis(3000)); fadeOut.play(); SequentialTransition seqT = new SequentialTransition(fadeIn, fadeOut); seqT.play(); seqT.setOnFinished((a) -> { labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: transparent;"); }); }
@Override protected void switchMenuTo(Node menu) { Node oldMenu = menuRoot.getChildren().get(0); FadeTransition ft = new FadeTransition(Duration.seconds(0.33), oldMenu); ft.setToValue(0); ft.setOnFinished(e -> { menu.setOpacity(0); menuRoot.getChildren().set(0, menu); oldMenu.setOpacity(1); FadeTransition ft2 = new FadeTransition(Duration.seconds(0.33), menu); ft2.setToValue(1); ft2.play(); }); ft.play(); }