本文整理匯總了Java中javafx.animation.ScaleTransition.setOnFinished方法的典型用法代碼示例。如果您正苦於以下問題:Java ScaleTransition.setOnFinished方法的具體用法?Java ScaleTransition.setOnFinished怎麽用?Java ScaleTransition.setOnFinished使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.ScaleTransition
的用法示例。
在下文中一共展示了ScaleTransition.setOnFinished方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setExitAnimationToNode
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
*
* @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());
}
示例2: keyPressedAnimation
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
* 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();
}
示例3: emphasise
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
* Performs an animation to get the users attention
*
* @param sf
* the scale factor to enlarge the window by (1.0 => no scale)
*/
protected final void emphasise(double sf) {
// Ignore if window is just being opened
if (getScaleX() == 1 && getScaleY() == 1 && !isExtracted) {
ScaleTransition sc = new ScaleTransition(Duration.millis(175), this);
sc.setToX(sf);
sc.setToY(sf);
sc.setCycleCount(2);
sc.setAutoReverse(true);
getStyleClass().add("highlighting");
sc.setOnFinished((e) -> getStyleClass().remove("highlighting"));
sc.play();
toFront();
} else if (isExtracted) {
extractedStage.toFront();
}
}
示例4: closeMdiWindow
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
public void closeMdiWindow() {
ScaleTransition st = new ScaleTransition(Duration.millis(100), borderPane);
st.setToX(0);
st.setToY(0);
st.setByX(1);
st.setByY(1);
st.setCycleCount(1);
st.play();
borderPane.fireEvent(new MDIEvent(null, MDIEvent.EVENT_CLOSED));
st.setOnFinished((ActionEvent t) -> {
MDICanvas mdiCanvas = (MDICanvas) this.getParent().getParent();
for (int i = 0; i < mdiCanvas.getPaneMDIContainer().getChildren().size(); i++) {
MDIWindow window = (MDIWindow) mdiCanvas.getPaneMDIContainer().getChildren().get(i);
if (window.getId().equals(borderPane.getId())) {
mdiCanvas.getPaneMDIContainer().getChildren().remove(i);
}
}
isClosed.setValue(true);
});
}
示例5: popupCloser
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
*
* @param pp
*/
private void popupCloser(Popup pp, Node node) {
ScaleTransition st = new ScaleTransition(Duration.seconds(.3), node);
st.setToX(0);
st.setToY(0);
st.play();
FadeTransition fd = new FadeTransition(Duration.seconds(.3), node);
fd.setToValue(.2);
fd.play();
st.setOnFinished(e -> pp.hide());
}
示例6: oakyButtonHandler
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
public void oakyButtonHandler(MouseEvent event, Popup pp) {
ScaleTransition st = new ScaleTransition(Duration.seconds(.3), (Node) pp.getContent());
st.setToX(0);
st.play();
FadeTransition fd = new FadeTransition(Duration.seconds(.3), (Node) pp.getContent());
fd.setToValue(.2);
st.setOnFinished(e -> pp.hide());
}
示例7: animateNewlyAddedTile
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
* 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;
}
示例8: bounce
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
* Makes the entry view "bounce" by applying a scale transition. This is a
* good way to make an entry stand out, e.g. when it receives the keyboard
* focus.
*/
public final void bounce() {
ScaleTransition transition = new ScaleTransition(Duration.millis(200), this);
setCache(true);
setCacheHint(CacheHint.SCALE);
transition.setAutoReverse(true);
transition.setFromX(1);
transition.setToX(.8);
transition.setFromY(1);
transition.setToY(.8);
transition.setCycleCount(2);
transition.setOnFinished(evt -> setCache(false));
transition.play();
}
示例9: AnimatedPopup
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private AnimatedPopup() {
showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
showFadeTransition.setFromValue(0);
showFadeTransition.setToValue(1);
showFadeTransition.setInterpolator(new BackInterpolator());
showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
showScaleTransition.setFromX(0.8);
showScaleTransition.setFromY(0.8);
showScaleTransition.setToY(1);
showScaleTransition.setToX(1);
showScaleTransition.setInterpolator(new BackInterpolator());
hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
hideFadeTransition.setFromValue(1);
hideFadeTransition.setToValue(0);
hideFadeTransition.setInterpolator(new BackInterpolator());
hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
hideScaleTransition.setFromX(1);
hideScaleTransition.setFromY(1);
hideScaleTransition.setToY(0.8);
hideScaleTransition.setToX(0.8);
hideScaleTransition.setInterpolator(new BackInterpolator());
hideScaleTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
if (AnimatedPopup.super.isShowing()) {
AnimatedPopup.super.hide();
}
}
});
}
示例10: close
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/** Closes this menu by removing it from it's parent. */
public void close(boolean byMouse) {
// disable it first, before removal in a closing animation
this.setMouseTransparent(true);
ScaleTransition closing = new ScaleTransition(byMouse ? Duration.ONE :Duration.millis(300), this);
closing.setToX(0.3);
closing.setToY(0.1);
closing.setOnFinished(e -> parent.removeMenu(this));
closing.play();
}
示例11: animateNewlyAddedTile
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
* 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), 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 (checkEndGame()) {
board.setGameOver(true);
}
});
return scaleTransition;
}
示例12: AnimatedPopup
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
AnimatedPopup() {
super();
Interpolator interpolator = new PopupInterpolator();
showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
showFadeTransition.setFromValue(0);
showFadeTransition.setToValue(1);
showFadeTransition.setInterpolator(interpolator);
showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
showScaleTransition.setFromX(0.8);
showScaleTransition.setFromY(0.8);
showScaleTransition.setToY(1);
showScaleTransition.setToX(1);
showScaleTransition.setInterpolator(interpolator);
hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
hideFadeTransition.setFromValue(1);
hideFadeTransition.setToValue(0);
hideFadeTransition.setInterpolator(interpolator);
hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
hideScaleTransition.setFromX(1);
hideScaleTransition.setFromY(1);
hideScaleTransition.setToY(0.8);
hideScaleTransition.setToX(0.8);
hideScaleTransition.setInterpolator(interpolator);
hideScaleTransition.setOnFinished(
actionEvent -> {
if (AnimatedPopup.super.isShowing()) {
AnimatedPopup.super.hide();
}
}
);
this.closingHandler = (
event -> {
final Popup p = popupDialog;
if (p != null) {
p.getOwnerWindow().removeEventFilter(
WindowEvent.WINDOW_CLOSE_REQUEST,
getClosingHandler());
if (p.isShowing()) {
// first closing request will only close the popup dialog but not the window
p.hide();
event.consume();
}
popupDialog = null;
}
}
);
}