本文整理匯總了Java中javafx.animation.ScaleTransition.play方法的典型用法代碼示例。如果您正苦於以下問題:Java ScaleTransition.play方法的具體用法?Java ScaleTransition.play怎麽用?Java ScaleTransition.play使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.ScaleTransition
的用法示例。
在下文中一共展示了ScaleTransition.play方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: buttonClicked
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
*
* @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));
}
}
示例3: 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();
}
示例4: animate
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
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();
}
示例5: 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();
}
}
示例6: 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);
});
}
示例7: moveToDeck
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
* Method to display the movement of a card to a Deck
* @param card the card to move
*/
private PathTransition moveToDeck(Card card) {
StackPane deck = ownerToDeck(card.getOwner());
Path path = new Path(new MoveTo(card.localToParent(0,0).getX() + card.getWidth()/2, card.localToParent(0,0).getY() + card.getHeight()/2),
new LineTo(deck.localToParent(deck.getWidth()/2.,deck.getHeight()/2.).getX(), deck.localToParent(deck.getWidth()/2.,deck.getHeight()/2.).getY()));
boolean horizontal = card.getOwner() == Owner.PROJECT_DECK || card.getOwner() == Owner.PROJECT_DISCARD;
card.toFront();
if (horizontal) {
RotateTransition rotateTransition = new RotateTransition(Duration.millis(500), card);
rotateTransition.setByAngle(-90);
rotateTransition.play();
}
ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(500), card);
scaleTransition.setToX(horizontal ? deck.getScaleY() : deck.getScaleX());
scaleTransition.setToY(horizontal ? deck.getScaleX() : deck.getScaleY());
scaleTransition.play();
card.setClickable(false, view);
return new PathTransition(Duration.seconds(.5),path,card);
}
示例8: animateButton
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
* Animates a custom button with a scale transition.
*
* @param pButton the button
* @see ScaleTransition
*/
private void animateButton(Button pButton)
{
pButton.setEffect(effButtonColorAdjust);
Animation an = htButtonAnimations.get(pButton);
if (an != null)
{
an.playFromStart();
}
else
{
ScaleTransition st = new ScaleTransition(Duration.millis(120), pButton);
st.setByX(0.4f);
st.setByY(0.4f);
st.setCycleCount(2);
st.setAutoReverse(true);
htButtonAnimations.put(pButton, st);
st.play();
}
}
示例9: initialize
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
@Override
public void initialize(URL location, ResourceBundle resources) {
propertyCollector = PropertyCollector.create();
if (!propertyCollector.isJDKCorrect() && propertyCollector.getProperty("jdk") == null) {
createProject.setDisable(true);
}
ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(2000), coconutPng);
scaleTransition.setToX(1.1f);
scaleTransition.setToY(1.1f);
scaleTransition.setCycleCount(Timeline.INDEFINITE);
scaleTransition.setAutoReverse(true);
scaleTransition.play();
}
示例10: popupOpener
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
*
* @param pp
* @param node
*/
private void popupOpener(Node node) {
ScaleTransition st = new ScaleTransition(Duration.seconds(.3), node);
st.setFromX(.2);
st.setFromY(.2);
st.setToX(1);
st.setToY(1);
st.play();
FadeTransition fd = new FadeTransition(Duration.seconds(.2), node);
fd.setFromValue(.2);
fd.setToValue(1);
fd.play();
}
示例11: 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());
}
示例12: buttonHovered
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
*
* @param b
*/
public void buttonHovered(Button b) {
ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
st.setToX(1.6);
st.setToY(1.6);
st.play();
}
示例13: buttonHoveredOff
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
*
* @param b
*/
public void buttonHoveredOff(Button b) {
ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
st.setToX(1);
st.setToY(1);
st.play();
}
示例14: 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());
}
示例15: 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();
}