本文整理匯總了Java中javafx.animation.ScaleTransition.setAutoReverse方法的典型用法代碼示例。如果您正苦於以下問題:Java ScaleTransition.setAutoReverse方法的具體用法?Java ScaleTransition.setAutoReverse怎麽用?Java ScaleTransition.setAutoReverse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.ScaleTransition
的用法示例。
在下文中一共展示了ScaleTransition.setAutoReverse方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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
示例2: 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();
}
}
示例3: 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();
}
}
示例4: 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();
}
示例5: 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();
}
示例6: 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();
}
示例7: layoutChildren
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override public void layoutChildren() {
final boolean wasShowing = imageView.isVisible();
final boolean isShowing = isShowing();
imageView.setVisible(isShowing);
if (!isShowing) {
return;
}
final double glassPaneWidth = snapSize(glassPane.getWidth());
final double glassPaneHeight = snapSize(glassPane.getHeight());
final double imageWidth = imageView.getLayoutBounds().getWidth();
final double imageHeight = imageView.getLayoutBounds().getHeight();
imageView.relocate(glassPaneWidth / 2.0 - imageWidth / 2.0, glassPaneHeight / 2.0 - imageHeight / 2.0);
if (!wasShowing && isShowing) {
ScaleTransition st = new ScaleTransition(Duration.millis(250), imageView);
st.setByX(1.0f);
st.setByY(1.0f);
st.setCycleCount(1);
st.setAutoReverse(true);
st.play();
}
}
示例8: JoustToken
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
public JoustToken(GameBoardView boardView, Card card, boolean up, boolean won) {
Window parent = boardView.getScene().getWindow();
this.cardToken = new CardTooltip();
popup = new Popup();
popup.getContent().setAll(cardToken);
popup.setX(parent.getX() + 600);
popup.show(parent);
int offsetY = up ? -200 : 100;
popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5 + offsetY);
cardToken.setCard(card);
NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
FadeTransition animation = new FadeTransition(Duration.seconds(1.0), cardToken);
animation.setDelay(Duration.seconds(1f));
animation.setOnFinished(this::onComplete);
animation.setFromValue(1);
animation.setToValue(0);
animation.play();
if (won) {
ScaleTransition scaleAnimation = new ScaleTransition(Duration.seconds(0.5f), cardToken);
scaleAnimation.setByX(0.1);
scaleAnimation.setByY(0.1);
scaleAnimation.setCycleCount(2);
scaleAnimation.setAutoReverse(true);
scaleAnimation.play();
}
}
示例9: playBusyAnimation
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
* Creates an animation that indicates that the selected symbol has already
* been placed there.
*/
public void playBusyAnimation(){
ImageView symbol = (ImageView) this.getChildren().get(0);
ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(100), symbol);
scaleTransition.setToX(1.10);
scaleTransition.setToY(1.10);
scaleTransition.setAutoReverse(true);
scaleTransition.setCycleCount(2);
scaleTransition.play();
}
示例10: startButtonPressed
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
@FXML
private void startButtonPressed(ActionEvent event)
{
// transition that changes a shape's fill
FillTransition fillTransition =
new FillTransition(Duration.seconds(1));
fillTransition.setToValue(Color.CYAN);
fillTransition.setCycleCount(2);
// each even cycle plays transition in reverse to restore original
fillTransition.setAutoReverse(true);
// transition that changes a shape's stroke over time
StrokeTransition strokeTransition =
new StrokeTransition(Duration.seconds(1));
strokeTransition.setToValue(Color.BLUE);
strokeTransition.setCycleCount(2);
strokeTransition.setAutoReverse(true);
// parallelizes multiple transitions
ParallelTransition parallelTransition =
new ParallelTransition(fillTransition, strokeTransition);
// transition that changes a node's opacity over time
FadeTransition fadeTransition =
new FadeTransition(Duration.seconds(1));
fadeTransition.setFromValue(1.0); // opaque
fadeTransition.setToValue(0.0); // transparent
fadeTransition.setCycleCount(2);
fadeTransition.setAutoReverse(true);
// transition that rotates a node
RotateTransition rotateTransition =
new RotateTransition(Duration.seconds(1));
rotateTransition.setByAngle(360.0);
rotateTransition.setCycleCount(2);
rotateTransition.setInterpolator(Interpolator.EASE_BOTH);
rotateTransition.setAutoReverse(true);
// transition that moves a node along a Path
Path path = new Path(new MoveTo(45, 45), new LineTo(45, 0),
new LineTo(90, 0), new LineTo(90, 90), new LineTo(0, 90));
PathTransition translateTransition =
new PathTransition(Duration.seconds(2), path);
translateTransition.setCycleCount(2);
translateTransition.setInterpolator(Interpolator.EASE_IN);
translateTransition.setAutoReverse(true);
// transition that scales a shape to make it larger or smaller
ScaleTransition scaleTransition =
new ScaleTransition(Duration.seconds(1));
scaleTransition.setByX(0.75);
scaleTransition.setByY(0.75);
scaleTransition.setCycleCount(2);
scaleTransition.setInterpolator(Interpolator.EASE_OUT);
scaleTransition.setAutoReverse(true);
// transition that applies a sequence of transitions to a node
SequentialTransition sequentialTransition =
new SequentialTransition (rectangle, parallelTransition,
fadeTransition, rotateTransition, translateTransition,
scaleTransition);
sequentialTransition.play(); // play the transition
}
開發者ID:cleitonferreira,項目名稱:LivroJavaComoProgramar10Edicao,代碼行數:65,代碼來源:TransitionAnimationsController.java