private void playCrossfade(final List<? extends Playable> items, final int index) { MediaPlayer oldPlayer = currentPlayer; final double currentVolume = oldPlayer.getVolume(); oldPlayer.volumeProperty().unbind(); playQueue = new ArrayList<>(items); currentIndex = index; MediaPlayer newPlayer = new MediaPlayer(new Media(playQueue.get(currentIndex).getUri().toString())); newPlayer.setVolume(0); newPlayer.play(); Timeline crossfade = new Timeline(new KeyFrame(Duration.seconds(CROSSFADE_DURATION), new KeyValue(oldPlayer.volumeProperty(), 0), new KeyValue(newPlayer.volumeProperty(), currentVolume))); crossfade.setOnFinished(event -> { oldPlayer.stop(); setCurrentPlayer(newPlayer); }); crossfade.play(); }
public static Pane animiereRechteck() { Random random = new Random(); Pane animationPane = new Pane(); animationPane.setPrefSize(500,200); Rectangle rect = new Rectangle(75, 75, 100, 50); animationPane.getChildren().add(rect); Timeline timeline = new Timeline(); timeline.setCycleCount(Timeline.INDEFINITE); timeline.setAutoReverse(true); KeyValue kVMoveX = new KeyValue(rect.xProperty(), random.nextInt(200) + 200); KeyValue kVRotate = new KeyValue(rect.rotateProperty(), random.nextInt(360) + 180); KeyValue kVArcHeight = new KeyValue(rect.arcHeightProperty(), 60); KeyValue kVArcWidth = new KeyValue(rect.arcWidthProperty(), 60); KeyFrame keyFrame = new KeyFrame(Duration.millis(random.nextInt(2000) + 2000), kVMoveX, kVRotate, kVArcHeight, kVArcWidth); timeline.getKeyFrames().add(keyFrame); timeline.play(); return animationPane; }
private void createLetter(String c) { final Text letter = new Text(c); letter.setFill(Color.BLACK); letter.setFont(FONT_DEFAULT); letter.setTextOrigin(VPos.TOP); letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2); letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2); getChildren().add(letter); // over 3 seconds move letter to random position and fade it out final Timeline timeline = new Timeline(); timeline.getKeyFrames().add( new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // we are done remove us from scene getChildren().remove(letter); } }, new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR), new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR), new KeyValue(letter.opacityProperty(), 0f) )); timeline.play(); }
@Override public void handleStateChangeNotification(StateChangeNotification evt) { if (evt.getType() == StateChangeNotification.Type.BEFORE_INIT) { // check if download was crazy fast and restart progress if ((System.currentTimeMillis() - startDownload) < 500) { raceTrack.setProgress(0); } // we have finished downloading application, now we are running application // init() method, as we have no way of calculating real progress // simplate pretend progress here simulatorTimeline = new Timeline(); simulatorTimeline.getKeyFrames().add( new KeyFrame(Duration.seconds(3), new KeyValue(raceTrack.progressProperty(),1) ) ); simulatorTimeline.play(); } }
@Override protected Timeline setupDismissAnimation() { Timeline tl = new Timeline(); KeyValue kv1 = new KeyValue(stage.yLocationProperty(), stage.getY() + stage.getWidth()); KeyFrame kf1 = new KeyFrame(Duration.millis(2000), kv1); KeyValue kv2 = new KeyValue(stage.opacityProperty(), 0.0); KeyFrame kf2 = new KeyFrame(Duration.millis(2000), kv2); tl.getKeyFrames().addAll(kf1, kf2); tl.setOnFinished(e -> { trayIsShowing = false; stage.close(); stage.setLocation(stage.getBottomRight()); }); return tl; }
private static void makeText(Stage ownerStage, String toastMsg, int toastDelay) { Stage toastStage = new Stage(); toastStage.initOwner(ownerStage); toastStage.setResizable(false); toastStage.initStyle(StageStyle.TRANSPARENT); Text text = new Text(toastMsg); text.setFont(Font.font("Verdana", 20)); text.setFill(Color.BLACK); StackPane root = new StackPane(text); root.setStyle("-fx-background-radius: 20; -fx-background-color: rgba(255, 255, 255, 0.9); -fx-padding: 20px;"); root.setOpacity(0); Scene scene = new Scene(root); scene.setFill(Color.TRANSPARENT); toastStage.setScene(scene); toastStage.show(); Timeline fadeInTimeline = new Timeline(); KeyFrame fadeInKey1 = new KeyFrame(Duration.millis(200), new KeyValue(toastStage.getScene().getRoot().opacityProperty(), 1)); fadeInTimeline.getKeyFrames().add(fadeInKey1); fadeInTimeline.setOnFinished((ae) -> new Thread(() -> { try { Thread.sleep(toastDelay); } catch (InterruptedException e) { e.printStackTrace(); } Timeline fadeOutTimeline = new Timeline(); KeyFrame fadeOutKey1 = new KeyFrame(Duration.millis(500), new KeyValue(toastStage.getScene().getRoot().opacityProperty(), 0)); fadeOutTimeline.getKeyFrames().add(fadeOutKey1); fadeOutTimeline.setOnFinished((aeb) -> toastStage.close()); fadeOutTimeline.play(); }).start()); fadeInTimeline.play(); }
void ensureVisible(double x, double y) { ScrollPane scrollPane = diagramController.getScrollPane(); double xScroll = (x - scrollPane.getWidth() / 2) / (8000 - scrollPane.getWidth()); double yScroll = (y - scrollPane.getHeight() / 2) / (8000 - scrollPane.getHeight()); final Timeline timeline = new Timeline(); final KeyValue kv1 = new KeyValue(scrollPane.hvalueProperty(), xScroll); final KeyValue kv2 = new KeyValue(scrollPane.vvalueProperty(), yScroll); final KeyFrame kf = new KeyFrame(Duration.millis(100), kv1, kv2); timeline.getKeyFrames().add(kf); timeline.play(); aScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); aScrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); }
/** * Create new ShakeTransition * * @param node The node to affect */ public ShakeTransition(final Node node) { super( node, new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.translateXProperty(), 0, WEB_EASE)), new KeyFrame(Duration.millis(100), new KeyValue(node.translateXProperty(), -10, WEB_EASE)), new KeyFrame(Duration.millis(200), new KeyValue(node.translateXProperty(), 10, WEB_EASE)), new KeyFrame(Duration.millis(300), new KeyValue(node.translateXProperty(), -10, WEB_EASE)), new KeyFrame(Duration.millis(400), new KeyValue(node.translateXProperty(), 10, WEB_EASE)), new KeyFrame(Duration.millis(500), new KeyValue(node.translateXProperty(), -10, WEB_EASE)), new KeyFrame(Duration.millis(600), new KeyValue(node.translateXProperty(), 10, WEB_EASE)), new KeyFrame(Duration.millis(700), new KeyValue(node.translateXProperty(), -10, WEB_EASE)), new KeyFrame(Duration.millis(800), new KeyValue(node.translateXProperty(), 10, WEB_EASE)), new KeyFrame(Duration.millis(900), new KeyValue(node.translateXProperty(), -10, WEB_EASE)), new KeyFrame(Duration.millis(1000), new KeyValue(node.translateXProperty(), 0, WEB_EASE)) ) ); setCycleDuration(Duration.seconds(1)); setDelay(Duration.seconds(0.2)); }
private Timeline startAnimateForm300() { Timeline tml = new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(pnlContent.maxHeightProperty(), 70)), new KeyFrame(Duration.seconds(0.4), new KeyValue(pnlContent.maxHeightProperty(), 300, Interpolator.EASE_BOTH))); tml.setOnFinished((ActionEvent event) -> { pnlForm.setVisible(true); txtSend.requestFocus(); }); return tml; }
private Circle createMovingCircle(Interpolator interpolator) { //create a transparent circle Circle circle = new Circle(45,45, 40, Color.web("1c89f4")); circle.setOpacity(0); //add effect circle.setEffect(new Lighting()); //create a timeline for moving the circle timeline.setCycleCount(Timeline.INDEFINITE); timeline.setAutoReverse(true); //create a keyValue for horizontal translation of circle to the position 155px with given interpolator KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator); //create a keyFrame with duration 4s KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue); //add the keyframe to the timeline timeline.getKeyFrames().add(keyFrame); return circle; }
@Override public void start(Stage stage) throws Exception { preloaderStage = stage; preloaderStage.setScene(preloaderScene); preloaderStage.show(); if (DEMO_MODE) { final DoubleProperty prog = new SimpleDoubleProperty(0){ @Override protected void invalidated() { handleProgressNotification(new ProgressNotification(get())); } }; Timeline t = new Timeline(); t.getKeyFrames().add(new KeyFrame(Duration.seconds(20), new KeyValue(prog, 1))); t.play(); } }
public TimelineSample() { super(280,120); //create a circle final Circle circle = new Circle(25,25, 20, Color.web("1c89f4")); circle.setEffect(new Lighting()); //create a timeline for moving the circle timeline = new Timeline(); timeline.setCycleCount(Timeline.INDEFINITE); timeline.setAutoReverse(true); //one can start/pause/stop/play animation by //timeline.play(); //timeline.pause(); //timeline.stop(); //timeline.playFromStart(); //add the following keyframes to the timeline timeline.getKeyFrames().addAll (new KeyFrame(Duration.ZERO, new KeyValue(circle.translateXProperty(), 0)), new KeyFrame(new Duration(4000), new KeyValue(circle.translateXProperty(), 205))); getChildren().add(createNavigation()); getChildren().add(circle); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d) //TODO it is possible to do it for integer? ); // END REMOVE ME }
@Override public Node create3dContent() { Cube c = new Cube(50,Color.RED,1); c.rx.setAngle(45); c.ry.setAngle(45); Cube c2 = new Cube(50,Color.GREEN,1); c2.setTranslateX(100); c2.rx.setAngle(45); c2.ry.setAngle(45); Cube c3 = new Cube(50,Color.ORANGE,1); c3.setTranslateX(-100); c3.rx.setAngle(45); c3.ry.setAngle(45); animation = new Timeline(); animation.getKeyFrames().addAll( new KeyFrame(Duration.ZERO, new KeyValue(c.ry.angleProperty(), 0d), new KeyValue(c2.rx.angleProperty(), 0d), new KeyValue(c3.rz.angleProperty(), 0d) ), new KeyFrame(Duration.seconds(1), new KeyValue(c.ry.angleProperty(), 360d), new KeyValue(c2.rx.angleProperty(), 360d), new KeyValue(c3.rz.angleProperty(), 360d) )); animation.setCycleCount(Animation.INDEFINITE); return new Group(c,c2,c3); }
public void animateScore() { if(gameMovePoints.get()==0){ return; } final Timeline timeline = new Timeline(); lblPoints.setText("+" + gameMovePoints.getValue().toString()); lblPoints.setOpacity(1); double posX=vScore.localToScene(vScore.getWidth()/2d,0).getX(); lblPoints.setTranslateX(0); lblPoints.setTranslateX(lblPoints.sceneToLocal(posX, 0).getX()-lblPoints.getWidth()/2d); lblPoints.setLayoutY(20); final KeyValue kvO = new KeyValue(lblPoints.opacityProperty(), 0); final KeyValue kvY = new KeyValue(lblPoints.layoutYProperty(), 100); Duration animationDuration = Duration.millis(600); final KeyFrame kfO = new KeyFrame(animationDuration, kvO); final KeyFrame kfY = new KeyFrame(animationDuration, kvY); timeline.getKeyFrames().add(kfO); timeline.getKeyFrames().add(kfY); timeline.play(); }
/** * Animation that moves the tile from its previous location to a new location * @param tile to be animated * @param newLocation new location of the tile * @return a timeline */ private Timeline animateExistingTile(Tile tile, Location newLocation) { Timeline timeline = new Timeline(); KeyValue kvX = new KeyValue(tile.layoutXProperty(), newLocation.getLayoutX(Board.CELL_SIZE) - (tile.getMinHeight() / 2), Interpolator.EASE_OUT); KeyValue kvY = new KeyValue(tile.layoutYProperty(), newLocation.getLayoutY(Board.CELL_SIZE) - (tile.getMinHeight() / 2), Interpolator.EASE_OUT); KeyFrame kfX = new KeyFrame(ANIMATION_EXISTING_TILE, kvX); KeyFrame kfY = new KeyFrame(ANIMATION_EXISTING_TILE, kvY); timeline.getKeyFrames().add(kfX); timeline.getKeyFrames().add(kfY); return timeline; }
private Timeline createDataRemoveTimeline(final Data<X, Y> item, final Node symbol, final Series<X, Y> series) { Timeline t = new Timeline(); // save data values in case the same data item gets added immediately. XYValueMap.put(item, ((Number) item.getYValue()).doubleValue()); t.getKeyFrames() .addAll(new KeyFrame(Duration.ZERO, new KeyValue(item.currentYProperty(), item.getCurrentY()), new KeyValue(item.currentXProperty(), item.getCurrentX())), new KeyFrame(Duration.millis(500), actionEvent -> { if (symbol != null) getPlotChildren().remove(symbol); removeDataItemFromDisplay(series, item); XYValueMap.clear(); }, new KeyValue(item.currentYProperty(), item.getYValue(), Interpolator.EASE_BOTH), new KeyValue(item.currentXProperty(), item.getXValue(), Interpolator.EASE_BOTH))); return t; }
private void animateDataAdd(Data<X, Y> item, Node bar) { double barVal; if (orientation == Orientation.VERTICAL) { barVal = ((Number) item.getYValue()).doubleValue(); if (barVal < 0) { bar.getStyleClass().add(NEGATIVE_STYLE); } item.setCurrentY(getY1Axis().toRealValue((barVal < 0) ? -bottomPos : bottomPos)); getPlotChildren().add(bar); item.setYValue(getY1Axis().toRealValue(barVal)); animate(new KeyFrame(Duration.ZERO, new KeyValue(item.currentYProperty(), item.getCurrentY())), new KeyFrame(Duration.millis(700), new KeyValue(item.currentYProperty(), item.getYValue(), Interpolator.EASE_BOTH))); } else { barVal = ((Number) item.getXValue()).doubleValue(); if (barVal < 0) { bar.getStyleClass().add(NEGATIVE_STYLE); } item.setCurrentX(getXAxis().toRealValue((barVal < 0) ? -bottomPos : bottomPos)); getPlotChildren().add(bar); item.setXValue(getXAxis().toRealValue(barVal)); animate(new KeyFrame(Duration.ZERO, new KeyValue(item.currentXProperty(), item.getCurrentX())), new KeyFrame(Duration.millis(700), new KeyValue(item.currentXProperty(), item.getXValue(), Interpolator.EASE_BOTH))); } }
private void initializeShakeAnimation() { final Interpolator interpolator = Interpolator.SPLINE(0.645, 0.045, 0.355, 1); final double startX = controller.root.getTranslateX(); final KeyValue kv1 = new KeyValue(controller.root.translateXProperty(), startX - 3, interpolator); final KeyValue kv2 = new KeyValue(controller.root.translateXProperty(), startX + 3, interpolator); final KeyValue kv3 = new KeyValue(controller.root.translateXProperty(), startX, interpolator); final KeyFrame kf1 = new KeyFrame(millis(50), kv1); final KeyFrame kf2 = new KeyFrame(millis(100), kv2); final KeyFrame kf3 = new KeyFrame(millis(150), kv1); final KeyFrame kf4 = new KeyFrame(millis(200), kv2); final KeyFrame kf5 = new KeyFrame(millis(250), kv3); shakeAnimation.getKeyFrames().addAll(kf1, kf2, kf3, kf4, kf5); }
private void moveCircle(Circle C) { double centerX = (scene.getWidth() - maxRadius) * Math.random() + maxRadius; double centerY = scene.getHeight(); C.setCenterX(centerX); //C.setTranslateY((scene.getHeight() - maxRadius) * Math.random() + maxRadius); C.setCenterY(centerY); double radius = (maxRadius - minRadius) * Math.random() + minRadius; C.setFill(new Color(Math.random(), Math.random(), Math.random(), 1)); C.setRadius(radius); Timeline timeline = new Timeline(); double timelength = ((maxTimeLength - minTimeLength) * Math.random() + minTimeLength) * 1000; timeline.getKeyFrames().add(new KeyFrame(new Duration(timelength), new KeyValue(C.centerYProperty(), 0 - maxRadius, Interpolator.EASE_IN))); /* SequentialTransition sequence = new SequentialTransition(); for(int i = 0; i < 10; i++) { sequence.getChildren().add(new KeyFrame(new Duration(timelength / 10), new KeyValue(C.centerXProperty(), centerX - 100))); sequence.getChildren().add(new KeyFrame(new Duration(timelength / 10), new KeyValue(C.centerXProperty(), centerX + 100))); }*/ timeline.play(); timeline.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { //moveCircle(C); newCircle(); } }); }
public Metronome() { // création du fond du métronome ImageView fond_metronome = new ImageView( new Image(Metronome.class.getResourceAsStream("images/metronome.png"))); fond_metronome.setFitHeight(40); fond_metronome.setPreserveRatio(true); // création de l'aiguille du métronome ImageView aiguille = new ImageView(new Image(Metronome.class.getResourceAsStream("images/aiguille.png"))); aiguille.setFitHeight(32); aiguille.setPreserveRatio(true); aiguille.setTranslateX(16); aiguille.setTranslateY(2); // on applique une transformation à l'aiguille Rotate rotation = new Rotate(0, 3, 29); aiguille.getTransforms().add(rotation); // création de l'animation de l'aiguille Timeline timeline = new Timeline(); timeline.getKeyFrames().addAll(new KeyFrame(Duration.ZERO, new KeyValue(rotation.angleProperty(), 45)), new KeyFrame(new Duration(1000), new KeyValue(rotation.angleProperty(), -45))); timeline.setAutoReverse(true); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play(); this.getChildren().add(fond_metronome); this.getChildren().add(aiguille); this.setTranslateX(400); this.setTranslateY(200); }
/** * Create new FlipInXTransition * * @param node The node to affect */ public FlipInXTransition(final Node node) { super( node, new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.rotateProperty(), -90, WEB_EASE), new KeyValue(node.opacityProperty(), 0, WEB_EASE) ), new KeyFrame(Duration.millis(400), new KeyValue(node.rotateProperty(), 10, WEB_EASE) ), new KeyFrame(Duration.millis(700), new KeyValue(node.rotateProperty(), -10, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.rotateProperty(), 0, WEB_EASE), new KeyValue(node.opacityProperty(), 1, WEB_EASE) ) ) ); setCycleDuration(Duration.seconds(1)); setDelay(Duration.seconds(0.2)); }
@Override protected void starting() { double startY = -node.localToScene(0, 0).getY() - node.getBoundsInParent().getHeight(); timeline = new Timeline(); timeline.getKeyFrames().add(new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), startY, WEB_EASE))); timeline.getKeyFrames().add(new KeyFrame(Duration.millis(600), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 30, WEB_EASE))); timeline.getKeyFrames().add(new KeyFrame(Duration.millis(800), new KeyValue(node.translateYProperty(), -10, WEB_EASE))); timeline.getKeyFrames().add(new KeyFrame(Duration.millis(1000), new KeyValue(node.translateYProperty(), 0, WEB_EASE))); super.starting(); }
/** * Create new FlipOutXTransition * * @param node The node to affect */ public FlipOutXTransition(final Node node) { super( node, new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.rotateProperty(), 0, WEB_EASE), new KeyValue(node.opacityProperty(), 1, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.rotateProperty(), -90, WEB_EASE), new KeyValue(node.opacityProperty(), 0, WEB_EASE) ) ) ); setCycleDuration(Duration.seconds(1)); setDelay(Duration.seconds(0.2)); }
@Override protected void starting() { double endX = -node.localToScene(0, 0).getX() - node.getBoundsInParent().getWidth(); timeline = new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.translateXProperty(), 0, WEB_EASE) ), new KeyFrame(Duration.millis(200), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateXProperty(), 20, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateXProperty(), endX, WEB_EASE) ) ); super.starting(); }
@Override protected Timeline setupDismissAnimation() { Timeline tl = new Timeline(); double offScreenX = stage.getOffScreenBounds().getX(); Interpolator interpolator = Interpolator.TANGENT(Duration.millis(300), 50); double trayPadding = 3; // The destination X location for the stage. Which is off the users screen // Since the tray has some padding, we want to hide that too KeyValue kvX = new KeyValue(stage.xLocationProperty(), offScreenX + trayPadding, interpolator); KeyFrame frame1 = new KeyFrame(Duration.millis(1400), kvX); // Change the opacity level to 0.4 over the duration of 2000 millis KeyValue kvOpacity = new KeyValue(stage.opacityProperty(), 0.4); KeyFrame frame2 = new KeyFrame(Duration.millis(2000), kvOpacity); tl.getKeyFrames().addAll(frame1, frame2); tl.setOnFinished(e -> { trayIsShowing = false; stage.close(); stage.setLocation(stage.getBottomRight()); }); return tl; }
@Override protected void starting() { super.starting(); rotate = new Rotate(0, node.getBoundsInLocal().getWidth(), node.getBoundsInLocal().getHeight()); timeline = new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(rotate.angleProperty(), 90, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(rotate.angleProperty(), 0, WEB_EASE) ) ); node.getTransforms().add(rotate); }
@Override protected void starting() { super.starting(); rotate = new Rotate(0, node.getBoundsInLocal().getWidth(), node.getBoundsInLocal().getHeight()); timeline = new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(rotate.angleProperty(), 0, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(rotate.angleProperty(), 90, WEB_EASE) ) ); node.getTransforms().add(rotate); }
/** * Create new FadeInUpTransition * * @param node The node to affect */ public FadeInUpTransition(final Node node) { super( node, new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), 20, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 0, WEB_EASE) ) ) ); setCycleDuration(Duration.seconds(1)); setDelay(Duration.seconds(0.2)); }
@Override protected void starting() { super.starting(); rotate = new Rotate(0, node.getBoundsInLocal().getWidth(), node.getBoundsInLocal().getHeight()); timeline = new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(rotate.angleProperty(), -90, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(rotate.angleProperty(), 0, WEB_EASE) ) ); node.getTransforms().add(rotate); }
@Override protected void starting() { super.starting(); rotate = new Rotate(0, node.getBoundsInLocal().getWidth(), node.getBoundsInLocal().getHeight()); timeline = new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(rotate.angleProperty(), 0, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(rotate.angleProperty(), -90, WEB_EASE) ) ); node.getTransforms().add(rotate); }
@Override protected Timeline setupDismissAnimation() { Timeline tl = new Timeline(); // At this stage the opacity is already at 1.0 // Lowers the opacity to 0.0 within 2000 milliseconds KeyValue kv1 = new KeyValue(stage.opacityProperty(), 0.0); KeyFrame kf1 = new KeyFrame(Duration.millis(2000), kv1); tl.getKeyFrames().addAll(kf1); // Action to be performed when the animation has finished tl.setOnFinished(e -> { trayIsShowing = false; stage.close(); stage.setLocation(stage.getBottomRight()); }); return tl; }
/** * Create new FadeOutUpTransition * * @param node The node to affect */ public FadeOutUpTransition(final Node node) { super( node, new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 0, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), -20, WEB_EASE) ) ) ); setCycleDuration(Duration.seconds(1)); setDelay(Duration.seconds(0.2)); }
@Override protected void starting() { double endY = -node.localToScene(0, 0).getY() -node.getBoundsInParent().getHeight(); timeline = new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.translateYProperty(), 0, WEB_EASE) ), new KeyFrame(Duration.millis(200), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 20, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), endY, WEB_EASE) ) ); super.starting(); }
/** * Create new FadeOutLeftTransition * * @param node The node to affect */ public FadeOutLeftTransition(final Node node) { super( node, new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateXProperty(), 0, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateXProperty(), -20, WEB_EASE) ) ) ); setCycleDuration(Duration.seconds(1)); setDelay(Duration.seconds(0.2)); }
@Override protected void starting() { double startY = node.getScene().getHeight() - node.localToScene(0, 0).getY(); timeline = new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), startY, WEB_EASE) ), new KeyFrame(Duration.millis(600), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), -30, WEB_EASE) ), new KeyFrame(Duration.millis(800), new KeyValue(node.translateYProperty(), 10, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.translateYProperty(), 0, WEB_EASE) )); super.starting(); }
/** * Create new FlipOutYTransition * * @param node The node to affect */ public FlipOutYTransition(final Node node) { super( node, new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(node.rotateProperty(), 0, WEB_EASE), new KeyValue(node.opacityProperty(), 1, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.rotateProperty(), -90, WEB_EASE), new KeyValue(node.opacityProperty(), 0, WEB_EASE) ) ) ); setCycleDuration(Duration.seconds(1)); setDelay(Duration.seconds(0.2)); }