本文整理匯總了Java中javafx.animation.FadeTransition.setDelay方法的典型用法代碼示例。如果您正苦於以下問題:Java FadeTransition.setDelay方法的具體用法?Java FadeTransition.setDelay怎麽用?Java FadeTransition.setDelay使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.FadeTransition
的用法示例。
在下文中一共展示了FadeTransition.setDelay方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showViewPreview
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void showViewPreview() {
LoggerFacade.INSTANCE.debug(this.getClass(), "Show view Preview"); // NOI18N
final PreviewView view = new PreviewView();
final PreviewPresenter presenter = view.getRealPresenter();
presenter.registerActions();
final Parent preview = view.getView();
preview.setOpacity(0.0d);
bpGameArea.setCenter(preview);
final FadeTransition ftHidePreviewView = new FadeTransition();
ftHidePreviewView.setDelay(Duration.millis(250.0d));
ftHidePreviewView.setDuration(Duration.millis(375.0d));
ftHidePreviewView.setFromValue(0.0d);
ftHidePreviewView.setToValue(1.0d);
ftHidePreviewView.setNode(preview);
ftHidePreviewView.playFromStart();
}
示例2: showNotification
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void showNotification(String text)
{
labelNotification.setText(text);
labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_NOTIFICATION));
FadeTransition fadeIn = new FadeTransition(Duration.millis(200), labelNotification);
fadeIn.setFromValue(0.0);
fadeIn.setToValue(1.0);
FadeTransition fadeOut = new FadeTransition(Duration.millis(400), labelNotification);
fadeOut.setFromValue(1.0);
fadeOut.setToValue(0.0);
fadeOut.setDelay(Duration.millis(3000));
fadeOut.play();
SequentialTransition seqT = new SequentialTransition(fadeIn, fadeOut);
seqT.play();
seqT.setOnFinished((a) -> {
labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: transparent;");
});
}
示例3: CardPlayedToken
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public CardPlayedToken(GameBoardView boardView, Card card) {
Window parent = boardView.getScene().getWindow();
this.cardToken = new CardTooltip();
popup = new Popup();
popup.getContent().setAll(cardToken);
popup.setX(parent.getX() + 40);
popup.show(parent);
popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);
cardToken.setCard(card);
NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
FadeTransition animation = new FadeTransition(Duration.seconds(1.2), cardToken);
animation.setDelay(Duration.seconds(0.6f));
animation.setOnFinished(this::onComplete);
animation.setFromValue(1);
animation.setToValue(0);
animation.play();
}
示例4: createRightContent
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private Node createRightContent() {
String title = "Please Subscribe :)";
HBox letters = new HBox(0);
letters.setAlignment(Pos.CENTER);
for (int i = 0; i < title.length(); i++) {
Text letter = new Text(title.charAt(i) + "");
letter.setFont(FONT);
letter.setFill(Color.WHITE);
letter.setOpacity(0);
letters.getChildren().add(letter);
FadeTransition ft = new FadeTransition(Duration.seconds(2), letter);
ft.setDelay(Duration.millis(i * 50));
ft.setToValue(1);
ft.setAutoReverse(true);
ft.setCycleCount(TranslateTransition.INDEFINITE);
ft.play();
}
return letters;
}
示例5: showText
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void showText(String text, Consumer<FadingNotificationText> cleanup) {
messageLabel.setText(text);
setOpacity(1.0);
FadeTransition fadeTransition = new FadeTransition(Duration.millis(200.0), this);
fadeTransition.setDelay(Duration.millis(3000.0));
fadeTransition.setFromValue(1.0);
fadeTransition.setToValue(0.0);
fadeTransition.setCycleCount(1);
fadeTransition.setAutoReverse(false);
fadeTransition.setOnFinished(event -> cleanup.accept(this));
fadeTransition.play();
}
示例6: start
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
Parent home = FXMLLoader.load(getClass().getResource("/fxml/Home.fxml"));
Parent launch = FXMLLoader.load(getClass().getResource("/fxml/Scene.fxml"));
StackPane stack = new StackPane();
stack.getChildren().add(home);
stack.getChildren().add(launch);
MainApp.childs = stack.getChildren();
Scene scene = new Scene(stack,1366,768);
scene.getStylesheets().add("/styles/Styles.css");
stage.setTitle("Shield");
stage.getIcons().add(new Image(getClass().getResourceAsStream( "/image/logo.png" )));
stage.minHeightProperty().set(500);
stage.minWidthProperty().set(650);
stage.setScene(scene);
stage.show();
FadeTransition ft = new FadeTransition(Duration.millis(500),launch);
ft.setFromValue(1.0);
ft.setToValue(0.0);
ft.setDelay(Duration.seconds(3));
ft.play();
ft.onFinishedProperty().set(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
MainApp.childs.get(MainApp.childs.size()-1).toBack();
}
});
}
示例7: fade
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
* Fading animation
*
* @param node, object that will be animated
* @param duration
* @param delay
* @param fadeType
*/
public static void fade(Object node, int duration, int delay, int fadeType) {
FadeTransition fadeAnimation = new FadeTransition(Duration.millis(duration), (Node) node);
if (delay != 0) {
fadeAnimation.setDelay(Duration.millis(delay));
}
fadeAnimation.setFromValue(fadeType == 1 ? 0 : 1);
fadeAnimation.setToValue(fadeType == 1 ? 1 : 0);
fadeAnimation.play();
}
示例8: JoustToken
import javafx.animation.FadeTransition; //導入方法依賴的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: doStep
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
@Override
public void doStep(final MachineContext context) {
WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");
VBox vbox = (VBox) wordleSkin.getNode().lookup("#tweetList");
List<Transition> transitions = new ArrayList<>();
vbox.getChildren().forEach(node -> transitions.add(new FlipOutXTransition(node)));
Node imageNode = wordleSkin.getNode().lookup("#tweetImage");
ParallelTransition flipOuts = new ParallelTransition();
if (null != imageNode) {
FadeTransition fadeTransition = new FadeTransition(Duration.seconds(2), imageNode);
fadeTransition.setDelay(Duration.seconds(0.2));
fadeTransition.fromValueProperty().setValue(1);
fadeTransition.toValueProperty().setValue(0);
flipOuts.getChildren().add(fadeTransition);
}
flipOuts.getChildren().addAll(transitions);
flipOuts.setOnFinished(e -> {
vbox.getChildren().removeAll();
wordleSkin.getPane().getChildren().remove(vbox);
if (null != imageNode) {
wordleSkin.getPane().getChildren().remove(imageNode);
}
context.proceed();
});
flipOuts.play();
}
示例10: checkState
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void checkState() {
for (Node car : cars) {
if (car.getBoundsInParent().intersects(frog.getBoundsInParent())) {
frog.setTranslateX(0);
frog.setTranslateY(600 - 39);
return;
}
}
if (frog.getTranslateY() <= 0) {
timer.stop();
String win = "YOU WIN";
HBox hBox = new HBox();
hBox.setTranslateX(300);
hBox.setTranslateY(250);
root.getChildren().add(hBox);
for (int i = 0; i < win.toCharArray().length; i++) {
char letter = win.charAt(i);
Text text = new Text(String.valueOf(letter));
text.setFont(Font.font(48));
text.setOpacity(0);
hBox.getChildren().add(text);
FadeTransition ft = new FadeTransition(Duration.seconds(0.66), text);
ft.setToValue(1);
ft.setDelay(Duration.seconds(i * 0.15));
ft.play();
}
}
}
示例11: addGebouwKaartViews
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
* Voeg gebouwKaart views toe aan de HandActionBarView.
* Wijzig de X coordinaat van elke GebouwKaartView zodat
* deze de vorige kaart overlapt.
*/
private void addGebouwKaartViews() {
Pane handPane = new Pane();
int x = 0; // X coordinaat (voor uitlijning)
int totalWidth = 0;
int index = 0;
int delay = 75;
// Loop door gebouwKaartViews en wijzig de X coordinaat.
for (GebouwKaartView gebouwKaartView: gebouwKaartViews) {
// gebouwKaartView.view().setLayoutX(x); // Zet X coordinaat
gebouwKaartView.view().setCache(true);
gebouwKaartView.view().setCacheShape(true);
gebouwKaartView.view().setCacheHint(CacheHint.SPEED);
gebouwKaartView.view().setRotate(calcRotation(index, gebouwKaartViews.size()));
handPane.getChildren().add(gebouwKaartView.view()); // Voeg view to aan Pane
totalWidth += gebouwKaartView.view().getPrefWidth();
TranslateTransition transition = new TranslateTransition(Duration.millis(250), gebouwKaartView.view());
transition.setDelay(Duration.millis(delay));
transition.setFromX(0);
transition.setToX(x);
FadeTransition fadeTransition = new FadeTransition(Duration.millis(125), gebouwKaartView.view());
fadeTransition.setDelay(Duration.millis(delay));
fadeTransition.setFromValue(0.0);
fadeTransition.setToValue(1.0);
fadeTransition.play();
transition.play();
delay += 75;
x += 130; // Verhoog X coordinaat met 100
index++;
}
handPane.setMaxWidth(totalWidth);
this.pane.getChildren().add(handPane);
StackPane.setAlignment(handPane, Pos.TOP_CENTER);
}
示例12: generateParticles
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
* Generates particles of the given VariableColor and creates animations for them.
* PreCondition: None.
* PostCondition: New particles have been generated and added to this ParticleExplosion.
*
* @param originX The starting X coordinate of the particles.
* @param originY The starting Y coordinate of the particles.
* @param radius The radius within which the particles can land.
* @param duration The length (in milliseconds) of the animation.
* @param numParticles The number of particles to generate.
* @param particleSize The radius of the particles
* @param color The color of the particles.
*/
public final void generateParticles(double originX, double originY, double radius,
double duration, int numParticles, double particleSize, VariableColor color) {
for (int i = 0; i < numParticles; i++) {
Rectangle particle = new Rectangle(originX, originY, particleSize, particleSize);
particle.setFill(color.toColor());
getChildren().add(particle);
//Generate a Transition to animate it
TranslateTransition translate = new TranslateTransition(Duration.millis(duration), particle);
//Move to a random point in the circle defined by center (originX, originY) and radius radius
double degree = Math.random() * 360; //Get an angle to move in
translate.setToX(Math.random() * radius * Math.cos(degree)); //Move in that direction
translate.setToY(Math.random() * radius * Math.sin(degree));
//Generate a FadeTransition after the first tenth of the movement
FadeTransition fade = new FadeTransition(Duration.millis(duration - (duration / 10)), particle);
fade.setDelay(Duration.millis(duration / 10));
fade.setFromValue(1.0);
fade.setToValue(0.0);
//Store the translate to play back
transitions.add(translate);
transitions.add(fade);
//If the duration of these particles is higher than that of any
//other particles, reset the ParticleExplosion's duration
if (duration > this.duration) this.duration = duration;
}
}
示例13: onActionShowMainMenu
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void onActionShowMainMenu() {
LoggerFacade.INSTANCE.debug(this.getClass(), "On action show MainMenu"); // NOI18N
// Dont listen in Preview and GameView on KeyEvents
PreferencesFacade.INSTANCE.putBoolean(
IGameConfiguration.PROP__KEY_RELEASED__FOR_GAMEVIEW,
IGameConfiguration.PROP__KEY_RELEASED__FOR_GAMEVIEW__DEFAULT_VALUE);
PreferencesFacade.INSTANCE.putBoolean(
IPreviewConfiguration.PROP__KEY_RELEASED__FOR_PREVIEW,
Boolean.FALSE);
// MainMenuView is shown
PreferencesFacade.INSTANCE.putBoolean(
IMainMenuConfiguration.PROP__MAIN_MENU_IS_SHOWN,
Boolean.TRUE);
// Button
lMenuButton.setDisable(Boolean.TRUE);
// HiddenLayer
apHiddenLayer.setOpacity(0.0d);
apHiddenLayer.setVisible(Boolean.TRUE);
apHiddenLayer.setManaged(Boolean.TRUE);
final FadeTransition ftShowHiddenLayer = new FadeTransition();
ftShowHiddenLayer.setDelay(Duration.millis(125.0d));
ftShowHiddenLayer.setDuration(Duration.millis(250.0d));
ftShowHiddenLayer.setFromValue(0.0d);
ftShowHiddenLayer.setToValue(1.0d);
ftShowHiddenLayer.setNode(apHiddenLayer);
// Init MainMenuView
final MainMenuView mainMenuView = new MainMenuView();
final Parent menu = mainMenuView.getView();
menu.setOpacity(0.0d);
bpMenuArea.setCenter(null);
bpMenuArea.setCenter(menu);
final FadeTransition ftShowMenuView = new FadeTransition();
ftShowMenuView.setDelay(Duration.millis(200.0d));
ftShowMenuView.setDuration(Duration.millis(375.0d));
ftShowMenuView.setFromValue(0.0d);
ftShowMenuView.setToValue(1.0d);
ftShowMenuView.setNode(menu);
ftShowMenuView.setOnFinished((ActionEvent event) -> {
bpMenuArea.setMouseTransparent(Boolean.FALSE);
if (this.hasMediaPlayerFollowing(MediaPlayer.Status.PLAYING)) {
mediaPlayer.pause();
}
ActionFacade.INSTANCE.handle(ON_ACTION__MANAGED_MAP_PLAYER);
});
// Move menu
final TranslateTransition translateTransition = new TranslateTransition();
translateTransition.setDelay(Duration.millis(200.0d));
translateTransition.setDuration(Duration.millis(375.0d));
translateTransition.setFromX(300.0d);
translateTransition.setToX(0.0d);
translateTransition.setNode(menu);
// Animate
final ParallelTransition pt = new ParallelTransition();
pt.getChildren().addAll(ftShowHiddenLayer, ftShowMenuView, translateTransition);
pt.playFromStart();
}
示例14: fadeSet
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void fadeSet(FadeTransition fade, double delayTime) {
fade.setDelay(Duration.seconds(delayTime));
fade.setFromValue(0.0f);
fade.setToValue(1.0f);
}