本文整理匯總了Java中javafx.animation.ScaleTransition.setByX方法的典型用法代碼示例。如果您正苦於以下問題:Java ScaleTransition.setByX方法的具體用法?Java ScaleTransition.setByX怎麽用?Java ScaleTransition.setByX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.ScaleTransition
的用法示例。
在下文中一共展示了ScaleTransition.setByX方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
});
}
示例2: 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();
}
}
示例3: 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();
}
}
示例4: 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();
}
}
示例5: 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
示例6: drawPolygon
import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private void drawPolygon() {
int categLength = categoriesName.length;
for (int j = 0; j < allCircle.size() / categLength; j++) {
double points[] = new double[categLength * 2];
int index = 0;
for (int i = 0; i < categLength; i++) {
points[index] = allCircle.get(i + categLength * j).getCenterX();
points[index + 1] = allCircle.get(i + categLength * j).getCenterY();
index = index + 2;
}
Polygon polygon = new Polygon(points);
polygon.setStroke(Color.TRANSPARENT);
polygon.setFill(getPolygonColor(j));
polygon.setStrokeWidth(2);
if (isAnimated) {
polygonTransitioAnimation = new ScaleTransition(Duration.millis(700), polygon);
polygonTransitioAnimation.setFromX(0);
polygonTransitioAnimation.setFromY(0);
polygonTransitioAnimation.setByX(1.0f);
polygonTransitioAnimation.setByY(1.0f);
polygonTransitioAnimation.play();
}
getChildren().add(polygon);
}
}