本文整理匯總了Java中javafx.animation.ScaleTransition.setToY方法的典型用法代碼示例。如果您正苦於以下問題:Java ScaleTransition.setToY方法的具體用法?Java ScaleTransition.setToY怎麽用?Java ScaleTransition.setToY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.ScaleTransition
的用法示例。
在下文中一共展示了ScaleTransition.setToY方法的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: lollipop
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
public static void lollipop(double x, double y) {
Circle circle = new Circle(x, y, 2);
circle.setFill(randomColor());
FrameController.instance.hover.getChildren().add(circle);
FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), circle);
fadeTransition.setAutoReverse(true);
fadeTransition.setCycleCount(2);
fadeTransition.setFromValue(0.0);
fadeTransition.setToValue(1.0);
ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(1000), circle);
scaleTransition.setToX(10.0);
scaleTransition.setToY(10.0);
scaleTransition.setCycleCount(1);
ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
parallelTransition.play();
executorService.schedule(() -> Platform.runLater(() ->
FrameController.instance.hover.getChildren().remove(circle)), 1000, TimeUnit.MILLISECONDS);
}
示例5: getAnimationLoseLife
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
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);
}
示例6: 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();
}
示例7: doOutputScaleAnimation
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private void doOutputScaleAnimation(){
ParallelTransition pt = new ParallelTransition();
for(Node c : outputTabContainer.getChildren()){
if(c == compilerArea) continue;
ScaleTransition scale = new ScaleTransition(Duration.millis(250), c);
scale.setFromX(1);
scale.setToX(1.15);
scale.setFromY(1);
scale.setToY(1.15);
scale.setAutoReverse(true);
scale.setCycleCount(2);
pt.getChildren().add(scale);
}
pt.play();
}
開發者ID:ProPra16,項目名稱:programmierpraktikum-abschlussprojekt-amigos,代碼行數:17,代碼來源:ExerciseController.java
示例8: animate
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
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);
});
}
示例9: 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();
}
}
示例10: 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);
});
}
示例11: 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);
}
示例12: autoFocusPolygonAnimated
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private void autoFocusPolygonAnimated(final LocationPolygon polygon) {
final double xScale = (foregroundPane.getBoundingBox().getWidth() / polygon.prefWidth(0))
* Constants.ZOOM_FIT_PERCENTAGE_WIDTH;
final double yScale = (foregroundPane.getBoundingBox().getHeight() / polygon.prefHeight(0))
* Constants.ZOOM_FIT_PERCENTAGE_HEIGHT;
final double scale = (xScale < yScale) ? xScale : yScale;
final ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(500));
scaleTransition.setToX(scale);
scaleTransition.setToY(scale);
scaleTransition.setCycleCount(1);
scaleTransition.setAutoReverse(true);
final Point2D transition = calculateTransition(scale, polygon);
final TranslateTransition translateTransition = new TranslateTransition(Duration.millis(500));
translateTransition.setToX(transition.getX());
translateTransition.setToY(transition.getY());
translateTransition.setCycleCount(1);
translateTransition.setAutoReverse(true);
final ParallelTransition parallelTransition
= new ParallelTransition(this, scaleTransition, translateTransition);
parallelTransition.play();
}
示例13: initializePromptMoveTransition
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private void initializePromptMoveTransition() {
ScaleTransition promptScale = new ScaleTransition(promptAnimationDuration, this.promptLabel);
promptScale.setFromX(1);
promptScale.setFromY(1);
promptScale.setToX(.7);
promptScale.setToY(.7);
promptScale.setInterpolator(promptAnimationInterpolator);
TranslateTransition promptTranslate = new TranslateTransition(promptAnimationDuration, this.promptLabel);
promptTranslate.setFromY(0);
promptTranslate.setToY(-AnchorPane.getTopAnchor(this.promptLabel) - 4);
promptTranslate.setInterpolator(promptAnimationInterpolator);
this.promptLabel.translateXProperty().bind(
this.promptLabel.widthProperty()
.multiply(this.promptLabel.scaleXProperty()
.subtract(1)
.divide(2)));
this.promptMoveAnimation = new ParallelTransition(promptScale, promptTranslate);
this.promptUp = false;
}
示例14: createWalletHideAnimation
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private Animation createWalletHideAnimation() {
try {
FadeTransition fade = new FadeTransition(Duration.millis(1000), this.knownWalletDetailContainer);
fade.setFromValue(1.0);
fade.setToValue(0.0);
fade.setCycleCount(1);
ScaleTransition scale = new ScaleTransition(Duration.millis(1000), this.knownWalletDetailContainer);
scale.setFromX(1.0);
scale.setToX(0.1);
scale.setFromY(1.0);
scale.setToY(0.1);
scale.setCycleCount(1);
ParallelTransition parallel = new ParallelTransition();
parallel.getChildren().addAll(fade, scale);
parallel.setCycleCount(1);
return parallel;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
示例15: createWalletShowAnimation
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private Animation createWalletShowAnimation() {
try {
FadeTransition fade = new FadeTransition(Duration.millis(1000), this.knownWalletDetailContainer);
fade.setFromValue(0.0);
fade.setToValue(1.0);
fade.setCycleCount(1);
ScaleTransition scale = new ScaleTransition(Duration.millis(1000), this.knownWalletDetailContainer);
scale.setFromX(0.1);
scale.setToX(1.0);
scale.setFromY(0.1);
scale.setToY(1.0);
scale.setCycleCount(1);
ParallelTransition parallel = new ParallelTransition();
parallel.getChildren().addAll(fade, scale);
parallel.setCycleCount(1);
return parallel;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}