當前位置: 首頁>>代碼示例>>Java>>正文


Java FadeTransition.setDelay方法代碼示例

本文整理匯總了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();
}
 
開發者ID:Naoghuman,項目名稱:SokubanFX,代碼行數:21,代碼來源:ApplicationPresenter.java

示例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;");
	});
}
 
開發者ID:deadlocker8,項目名稱:BudgetMaster,代碼行數:21,代碼來源:Controller.java

示例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();
}
 
開發者ID:demilich1,項目名稱:metastone,代碼行數:21,代碼來源:CardPlayedToken.java

示例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;
}
 
開發者ID:AlmasB,項目名稱:FXTutorials,代碼行數:22,代碼來源:MKXMenuApp.java

示例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();
}
 
開發者ID:kana0011,項目名稱:symmetrical-memory,代碼行數:15,代碼來源:FadingNotificationText.java

示例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();
        }
    });
}
 
開發者ID:prakamya-mishra,項目名稱:Shield,代碼行數:32,代碼來源:MainApp.java

示例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();
}
 
開發者ID:the-squad,項目名稱:sudoku-desktop-game,代碼行數:21,代碼來源:global.java

示例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();	
	}
}
 
開發者ID:demilich1,項目名稱:metastone,代碼行數:31,代碼來源:JoustToken.java

示例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();
}
 
開發者ID:TweetWallFX,項目名稱:TweetwallFX,代碼行數:28,代碼來源:Devoxx17FlipOutTweets.java

示例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();
        }
    }
}
 
開發者ID:AlmasB,項目名稱:FXTutorials,代碼行數:35,代碼來源:FroggerApp.java

示例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);
    }
 
開發者ID:Badmuts,項目名稱:Machiavelli,代碼行數:42,代碼來源:HandActionBarView.java

示例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;
    }
}
 
開發者ID:zx96,項目名稱:piupiu,代碼行數:43,代碼來源:ParticleExplosion.java

示例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();
}
 
開發者ID:Naoghuman,項目名稱:SokubanFX,代碼行數:68,代碼來源:ApplicationPresenter.java

示例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);
}
 
開發者ID:tjumyk,項目名稱:sevenwonders,代碼行數:6,代碼來源:Index.java


注:本文中的javafx.animation.FadeTransition.setDelay方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。