本文整理匯總了Java中javafx.animation.ParallelTransition類的典型用法代碼示例。如果您正苦於以下問題:Java ParallelTransition類的具體用法?Java ParallelTransition怎麽用?Java ParallelTransition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ParallelTransition類屬於javafx.animation包,在下文中一共展示了ParallelTransition類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: lollipop
import javafx.animation.ParallelTransition; //導入依賴的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);
}
示例2: handleCurrentValue
import javafx.animation.ParallelTransition; //導入依賴的package包/類
@Override protected void handleCurrentValue(final double VALUE) {
double deviation = calculateDeviation(VALUE);
updateState(deviation);
valueText.setText(String.format(locale, formatString, VALUE));
deviationText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", deviation));
RotateTransition rotateTransition = new RotateTransition(Duration.millis(200), triangle);
rotateTransition.setFromAngle(triangle.getRotate());
rotateTransition.setToAngle(state.angle);
FillTransition fillIndicatorTransition = new FillTransition(Duration.millis(200), triangle);
fillIndicatorTransition.setFromValue((Color) triangle.getFill());
fillIndicatorTransition.setToValue(state.color);
FillTransition fillReferenceTransition = new FillTransition(Duration.millis(200), deviationText);
fillReferenceTransition.setFromValue((Color) triangle.getFill());
fillReferenceTransition.setToValue(state.color);
FillTransition fillReferenceUnitTransition = new FillTransition(Duration.millis(200), deviationUnitText);
fillReferenceUnitTransition.setFromValue((Color) triangle.getFill());
fillReferenceUnitTransition.setToValue(state.color);
ParallelTransition parallelTransition = new ParallelTransition(rotateTransition, fillIndicatorTransition, fillReferenceTransition, fillReferenceUnitTransition);
parallelTransition.play();
}
示例3: doOutputScaleAnimation
import javafx.animation.ParallelTransition; //導入依賴的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
示例4: CardBox
import javafx.animation.ParallelTransition; //導入依賴的package包/類
public CardBox(final Card... CARDS) {
super(CARDS);
cards = FXCollections.observableArrayList();
cards.addAll(CARDS);
firstTime = true;
open = new BooleanPropertyBase(false) {
@Override protected void invalidated() { handleState(get()); }
@Override public Object getBean() { return CardBox.this; }
@Override public String getName() { return "open"; }
};
cardHandler = e -> handleCardSelect((Card) e.getSource());
selectedCard = cards.size() == 0 ? null : cards.get(cards.size() - 1);
openTransition = new ParallelTransition();
closeTransition = new SequentialTransition();
initGraphics();
registerListeners();
}
示例5: animate
import javafx.animation.ParallelTransition; //導入依賴的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);
});
}
示例6: update
import javafx.animation.ParallelTransition; //導入依賴的package包/類
@Override
public void update (Object object) {
ITurtleState state = (ITurtleState) object;
this.penStyleIndex = state.getPenStyle();
TranslateTransition tt = new TranslateTransition(Duration.millis(mySpeed), this);
double currentX = this.getTranslateX(); double currentY = this.getTranslateY();
tt.setByX(currentX); tt.setByY(currentY); tt.setToX(state.getX()); tt.setToY(state.getY());
RotateTransition rt = new RotateTransition(Duration.millis(mySpeed), this);
double currentHeading = this.getRotate();
rt.setByAngle(currentHeading); rt.setToAngle(state.getHeading());
ParallelTransition pt = new ParallelTransition();
pt.getChildren().addAll(tt, rt);
pt.setOnFinished(e -> {
updateTurtleState(state);
System.out.println("myturtle: " + this.toString());
tooltip.setText(this.toString());
});
pt.play();
}
示例7: animateCardMovement
import javafx.animation.ParallelTransition; //導入依賴的package包/類
/**
* Animates card movements.
*
* @param card The card view to animate.
* @param sourceX Source X coordinate of the card view.
* @param sourceY Source Y coordinate of the card view.
* @param targetX Destination X coordinate of the card view.
* @param targetY Destination Y coordinate of the card view.
* @param duration The duration of the animation.
* @param doAfter The action to perform after the animation has been completed.
*/
private void animateCardMovement(
CardView card, double sourceX, double sourceY,
double targetX, double targetY, Duration duration,
EventHandler<ActionEvent> doAfter) {
Path path = new Path();
path.getElements().add(new MoveToAbs(card, sourceX, sourceY));
path.getElements().add(new LineToAbs(card, targetX, targetY));
PathTransition pathTransition =
new PathTransition(duration, path, card);
pathTransition.setInterpolator(Interpolator.EASE_IN);
pathTransition.setOnFinished(doAfter);
Timeline blurReset = new Timeline();
KeyValue bx = new KeyValue(card.getDropShadow().offsetXProperty(), 0, Interpolator.EASE_IN);
KeyValue by = new KeyValue(card.getDropShadow().offsetYProperty(), 0, Interpolator.EASE_IN);
KeyValue br = new KeyValue(card.getDropShadow().radiusProperty(), 2, Interpolator.EASE_IN);
KeyFrame bKeyFrame = new KeyFrame(duration, bx, by, br);
blurReset.getKeyFrames().add(bKeyFrame);
ParallelTransition pt = new ParallelTransition(card, pathTransition, blurReset);
pt.play();
}
示例8: autoFocusPolygonAnimated
import javafx.animation.ParallelTransition; //導入依賴的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();
}
示例9: initializePromptMoveTransition
import javafx.animation.ParallelTransition; //導入依賴的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;
}
示例10: doStep
import javafx.animation.ParallelTransition; //導入依賴的package包/類
@Override
public void doStep(final MachineContext context) {
WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");
List<Transition> fadeOutTransitions = new ArrayList<>();
Duration defaultDuration = Duration.seconds(1.5);
// kill the remaining words from the cloud
wordleSkin.word2TextMap.entrySet().forEach(entry -> {
Text textNode = entry.getValue();
FadeTransition ft = new FadeTransition(defaultDuration, textNode);
ft.setToValue(0);
ft.setOnFinished((event) -> {
wordleSkin.getPane().getChildren().remove(textNode);
});
fadeOutTransitions.add(ft);
});
wordleSkin.word2TextMap.clear();
ParallelTransition fadeLOuts = new ParallelTransition();
fadeLOuts.getChildren().addAll(fadeOutTransitions);
fadeLOuts.setOnFinished(e -> context.proceed());
fadeLOuts.play();
}
示例11: setForecast
import javafx.animation.ParallelTransition; //導入依賴的package包/類
public void setForecast(final Weather forecast) {
final Image image = new Image(WeatherConditionMapper.getWeatherForecastIcon(forecast));
ParallelTransition pt = new ParallelTransition(
TransitionUtil.createOutFader(tempLabel),
TransitionUtil.createOutFader(titleLabel),
TransitionUtil.createOutFader(img)
);
pt.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
String day = forecastDayFormat.format(forecast.getForecastDate());
titleLabel.setText(day);
img.setImage(image);
tempLabel.setText(forecast.getHighTemp() + "/" + forecast.getLowTemp() + " °C");
ParallelTransition inFader = new ParallelTransition(
TransitionUtil.createInFader(tempLabel),
TransitionUtil.createInFader(titleLabel),
TransitionUtil.createInFader(img)
);
inFader.play();
}
});
pt.play();
}
示例12: createWalletHideAnimation
import javafx.animation.ParallelTransition; //導入依賴的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;
}
}
示例13: createWalletShowAnimation
import javafx.animation.ParallelTransition; //導入依賴的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;
}
}
示例14: animate
import javafx.animation.ParallelTransition; //導入依賴的package包/類
private void animate() {
final Animation frame3Transition = new Timeline(new KeyFrame(
Duration.ZERO,
new KeyValue(frame3.rotateProperty(), 0)),
new KeyFrame(Duration.millis(6700), new KeyValue(frame3.rotateProperty(), 360)));
frame3Transition.setCycleCount(Animation.INDEFINITE);
final Animation frame4Transition = new Timeline(new KeyFrame(
Duration.ZERO,
new KeyValue(frame4.rotateProperty(), 0)),
new KeyFrame(Duration.millis(12000), new KeyValue(frame4.rotateProperty(), 360)));
frame4Transition.setCycleCount(Animation.INDEFINITE);
final Animation frame5Transition = new Timeline(new KeyFrame(
Duration.ZERO,
new KeyValue(frame5.rotateProperty(), 0)),
new KeyFrame(Duration.millis(9000), new KeyValue(frame5.rotateProperty(), -360)));
frame5Transition.setCycleCount(Animation.INDEFINITE);
final ParallelTransition parallelTransition = new ParallelTransition(frame3Transition, frame4Transition, frame5Transition);
parallelTransition.play();
}
示例15: readyToGoAnimation
import javafx.animation.ParallelTransition; //導入依賴的package包/類
public void readyToGoAnimation() {
// Buttons slide in and clickable address appears simultaneously.
TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox);
arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2));
arrive.setToY(0.0);
FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl);
reveal.setToValue(1.0);
ParallelTransition group = new ParallelTransition(arrive, reveal);
group.setDelay(NotificationBarPane.ANIM_OUT_DURATION);
group.setCycleCount(1);
group.play();
}