Java Code Examples for javafx.animation.ScaleTransition#setInterpolator()
The following examples show how to use
javafx.animation.ScaleTransition#setInterpolator() .
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: GameManager.java From util4j with Apache License 2.0 | 5 votes |
/** * 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; }
Example 2
Source File: GameManager.java From util4j with Apache License 2.0 | 5 votes |
/** * 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); }
Example 3
Source File: GameManager.java From Game2048FX with GNU General Public License v3.0 | 5 votes |
/** * 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*timeFactor), tile); scaleTransition.setToX(1.0); scaleTransition.setToY(1.0); scaleTransition.setInterpolator(Interpolator.EASE_OUT); return scaleTransition; }
Example 4
Source File: GameManager.java From Game2048FX with GNU General Public License v3.0 | 5 votes |
/** * 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(Duration.millis(80*timeFactor), tile); scale0.setToX(1.2); scale0.setToY(1.2); scale0.setInterpolator(Interpolator.EASE_IN); final ScaleTransition scale1 = new ScaleTransition(Duration.millis(80*timeFactor), tile); scale1.setToX(1.0); scale1.setToY(1.0); scale1.setInterpolator(Interpolator.EASE_OUT); return new SequentialTransition(scale0, scale1); }