Java Code Examples for javafx.animation.TranslateTransition#setToY()
The following examples show how to use
javafx.animation.TranslateTransition#setToY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AndroidKeyboardService.java From attach with GNU General Public License v3.0 | 7 votes |
private static void adjustPosition(Node node, Parent parent, double kh) { if (node == null || node.getScene() == null || node.getScene().getWindow() == null) { return; } double tTot = node.getScene().getHeight(); double ty = node.getLocalToSceneTransform().getTy() + node.getBoundsInParent().getHeight() + 2; double y = 1; Parent root = parent == null ? node.getScene().getRoot() : parent; if (ty > tTot - kh) { y = tTot - ty - kh; } else if (kh == 0 && root.getTranslateY() != 0) { y = 0; } if (y <= 0) { if (debug) { LOG.log(Level.INFO, String.format("Moving %s %.2f pixels", root, y)); } final TranslateTransition transition = new TranslateTransition(Duration.millis(100), root); transition.setFromY(root.getTranslateY()); transition.setToY(y); transition.setInterpolator(Interpolator.EASE_OUT); transition.playFromStart(); } }
Example 2
Source File: IOSKeyboardService.java From attach with GNU General Public License v3.0 | 6 votes |
private static void adjustPosition(Node node, Parent parent, double kh) { if (node == null || node.getScene() == null || node.getScene().getWindow() == null) { return; } double tTot = node.getScene().getHeight(); double ty = node.getLocalToSceneTransform().getTy() + node.getBoundsInParent().getHeight() + 2; double y = 1; Parent root = parent == null ? node.getScene().getRoot() : parent; if (ty > tTot - kh) { y = tTot - ty - kh; } else if (kh == 0 && root.getTranslateY() != 0) { y = 0; } if (y <= 0) { if (debug) { LOG.log(Level.INFO, String.format("Moving %s %.2f pixels", root, y)); } final TranslateTransition transition = new TranslateTransition(Duration.millis(100), root); transition.setFromY(root.getTranslateY()); transition.setToY(y); transition.setInterpolator(Interpolator.EASE_OUT); transition.playFromStart(); } }
Example 3
Source File: SpaceInvadersController.java From FXGLGames with MIT License | 6 votes |
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); }
Example 4
Source File: LaunchScreeenController.java From FakeImageDetection with GNU General Public License v3.0 | 6 votes |
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); }); }
Example 5
Source File: SpaceInvadersController.java From FXGLGames with MIT License | 6 votes |
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); }
Example 6
Source File: HealingNumber.java From metastone with GNU General Public License v2.0 | 6 votes |
public HealingNumber(String text, GameToken parent) { this.parent = parent; setText(text); setFill(Color.GREEN); setStyle("-fx-font-size: 28pt; -fx-font-family: \"System\";-fx-font-weight: bolder;-fx-stroke: black;-fx-stroke-width: 2;"); setCache(true); setCacheHint(CacheHint.SPEED); parent.getAnchor().getChildren().add(this); NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED); TranslateTransition animation = new TranslateTransition(Duration.seconds(0.5), this); animation.setToY(-30); animation.setOnFinished(this::onComplete); animation.play(); }
Example 7
Source File: MKXMenuApp.java From FXTutorials with MIT License | 6 votes |
private Node createMiddleContent() { String title = "MKX Menu App"; HBox letters = new HBox(0); letters.setAlignment(Pos.CENTER); for (int i = 0; i < title.length(); i++) { Text letter = new Text(title.charAt(i) + ""); letter.setFont(FONT); letter.setFill(Color.WHITE); letters.getChildren().add(letter); TranslateTransition tt = new TranslateTransition(Duration.seconds(2), letter); tt.setDelay(Duration.millis(i * 50)); tt.setToY(-25); tt.setAutoReverse(true); tt.setCycleCount(TranslateTransition.INDEFINITE); tt.play(); } return letters; }
Example 8
Source File: MainController.java From green_android with GNU General Public License v3.0 | 5 votes |
public void readyToGoAnimation() { // Buttons slide in and clickable address appears simultaneously. TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox); arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2)); arrive.setToY(0.0); FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl); reveal.setToValue(1.0); ParallelTransition group = new ParallelTransition(arrive, reveal); group.setDelay(NotificationBarPane.ANIM_OUT_DURATION); group.setCycleCount(1); group.play(); }
Example 9
Source File: LaunchScreeenController.java From FakeImageDetection with GNU General Public License v3.0 | 5 votes |
private void removeBannersandDescs() { TranslateTransition tChristopher = new TranslateTransition(Duration.millis(duration), christopher); TranslateTransition tDescription = new TranslateTransition(Duration.millis(duration), description); tChristopher.setToY(-200); tDescription.setToY(1000); ParallelTransition pt = new ParallelTransition(tChristopher, tDescription); pt.play(); }
Example 10
Source File: NeuralnetInterfaceController.java From FakeImageDetection with GNU General Public License v3.0 | 5 votes |
private void removeBannersandDescs() { TranslateTransition tChristopher = new TranslateTransition(Duration.millis(1000), christopher); TranslateTransition tDescription = new TranslateTransition(Duration.millis(1000), description); tChristopher.setToY(-500); tDescription.setToY(-500); ParallelTransition pt = new ParallelTransition(tChristopher, tDescription); pt.play(); }
Example 11
Source File: MainController.java From GreenBits with GNU General Public License v3.0 | 5 votes |
public void readyToGoAnimation() { // Buttons slide in and clickable address appears simultaneously. TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox); arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2)); arrive.setToY(0.0); FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl); reveal.setToValue(1.0); ParallelTransition group = new ParallelTransition(arrive, reveal); group.setDelay(NotificationBarPane.ANIM_OUT_DURATION); group.setCycleCount(1); group.play(); }
Example 12
Source File: Connect4App.java From FXTutorials with MIT License | 5 votes |
private void placeDisc(Disc disc, int column) { int row = ROWS - 1; do { if (!getDisc(column, row).isPresent()) break; row--; } while (row >= 0); if (row < 0) return; grid[column][row] = disc; discRoot.getChildren().add(disc); disc.setTranslateX(column * (TILE_SIZE + 5) + TILE_SIZE / 4); final int currentRow = row; TranslateTransition animation = new TranslateTransition(Duration.seconds(0.5), disc); animation.setToY(row * (TILE_SIZE + 5) + TILE_SIZE / 4); animation.setOnFinished(e -> { if (gameEnded(column, currentRow)) { gameOver(); } redMove = !redMove; }); animation.play(); }