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


Java Animation.setOnFinished方法代碼示例

本文整理匯總了Java中javafx.animation.Animation.setOnFinished方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.setOnFinished方法的具體用法?Java Animation.setOnFinished怎麽用?Java Animation.setOnFinished使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.animation.Animation的用法示例。


在下文中一共展示了Animation.setOnFinished方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: seriesBeingRemovedIsAdded

import javafx.animation.Animation; //導入方法依賴的package包/類
@Override
void seriesBeingRemovedIsAdded(Series<X, Y> series) {
	boolean lastSeries = (pt.getChildren().size() == 1) ? true : false;
	if (pt != null) {
		if (!pt.getChildren().isEmpty()) {
			for (Animation a : pt.getChildren()) {
				a.setOnFinished(null);
			}
		}
		for (Data<X, Y> item : series.getData()) {
			processDataRemove(series, item);
			if (!lastSeries) {
				restoreDataValues(item);
			}
		}
		XYValueMap.clear();
		pt.setOnFinished(null);
		pt.getChildren().clear();
		pt.stop();
		removeSeriesFromDisplay(series);
	}
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:23,代碼來源:MultiAxisBarChart.java

示例2: hideWithAnimation

import javafx.animation.Animation; //導入方法依賴的package包/類
/**
 * play the hide animation for the dialog, as the java hide method is set to final
 * can not be overridden
 */
public void hideWithAnimation() {
    if(transition==null || transition.getStatus().equals(Animation.Status.STOPPED)){
        if (getAnimation() != null) {
            Animation animation = getAnimation().createHidingAnimation(contentContainer.getParent(), overlay);
            if (animation != null) {
                transition = animation;
                animation.setOnFinished(finish -> {
                    this.hide();
                    this.transition = null;
                });
                animation.play();
            } else {
                Platform.runLater(this::hide);
            }
        }
    }
}
 
開發者ID:jfoenixadmin,項目名稱:JFoenix,代碼行數:22,代碼來源:JFXAlert.java

示例3: createAnimation

import javafx.animation.Animation; //導入方法依賴的package包/類
public void createAnimation(){

        Animation animation = new Transition() {

            {
                setCycleDuration(Duration.millis(3000));
                hboxFirst.getChildren().removeAll(imgView1, imgView2, imgView3);
                hboxFirst.getChildren().add(imgView4);
                String musicFileBravo =  System.getProperties().getProperty("user.home") + File.separator + "GazePlay" + File.separator + "files" + File.separator + "myGame"+File.separator+"applause.mp3";
                File fSound = new File(musicFileBravo);

                Media firstSound = new Media(fSound.toURI().toString());
                MediaPlayer mediaPlayerBravo = new MediaPlayer(firstSound);
                mediaPlayerBravo.play();
            }

            @Override
            protected void interpolate(double frac) {
                final int n = Math.round(3000 * (float) frac);

            }
        };

        animation.play();

        animation.setOnFinished(new EventHandler<ActionEvent>() {


            @Override
            public void handle(ActionEvent actionEvent) {

                hboxFirst.getChildren().removeAll(imgView4);
                createGame(sceneFirst, hboxFirst);

            }
        });

    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:39,代碼來源:JeuAnimaux.java

示例4: animate

import javafx.animation.Animation; //導入方法依賴的package包/類
public void animate() {
    init();
    Animation exitAnimation = animateExit();
    Animation sharedAnimation = animateSharedNodes();
    Animation enteranceAnimation = animateEntrance();
    exitAnimation.setOnFinished((finish) -> sharedAnimation.play());
    sharedAnimation.setOnFinished((finish) -> enteranceAnimation.play());
    enteranceAnimation.setOnFinished((finish) -> end());
    exitAnimation.play();
}
 
開發者ID:jfoenixadmin,項目名稱:JFoenix,代碼行數:11,代碼來源:JFXNodesAnimation.java

示例5: loseLife

import javafx.animation.Animation; //導入方法依賴的package包/類
public void loseLife() {
    Texture t = lives.get(lives.size() - 1);

    lives.remove(t);

    Animation animation = getAnimationLoseLife(t);
    animation.setOnFinished(e -> gameScene.removeUINode(t));
    animation.play();

    Viewport viewport = gameScene.getViewport();

    Node flash = new Rectangle(viewport.getWidth(), viewport.getHeight(), Color.rgb(190, 10, 15, 0.5));

    gameScene.addUINode(flash);

    FXGL.getMasterTimer().runOnceAfter(() -> gameScene.removeUINode(flash), Duration.seconds(1));
}
 
開發者ID:AlmasB,項目名稱:FXGLGames,代碼行數:18,代碼來源:GameController.java

示例6: createAnimation

import javafx.animation.Animation; //導入方法依賴的package包/類
public void createAnimation(){

        Animation animation = new Transition() {

            {
                setCycleDuration(Duration.millis(3000));
                hboxFirst.getChildren().removeAll(imgView1, imgView2, imgView3);
                hboxFirst.getChildren().add(imgView4);
                String musicFileBravo = "samplesAmela/sounds/applause.mp3";

                Media soundBravo = new Media(new File(musicFileBravo).toURI().toString());
                MediaPlayer mediaPlayerBravo = new MediaPlayer(soundBravo);
                mediaPlayerBravo.play();
            }

            @Override
            protected void interpolate(double frac) {
                final int n = Math.round(3000 * (float) frac);

            }
        };

        animation.play();

        animation.setOnFinished(new EventHandler<ActionEvent>() {


            @Override
            public void handle(ActionEvent actionEvent) {

                hboxFirst.getChildren().removeAll(imgView4);
                createGame(sceneFirst, hboxFirst, firstImage1, firstImage2, firstImage3, firstImage4, musicFileH, musicFileC, musicFileD, musicFileApp );

            }
        });

    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:38,代碼來源:ImagesInfinityRepeat.java

示例7: createAnimation

import javafx.animation.Animation; //導入方法依賴的package包/類
private  EventHandler<Event> createAnimation() {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {



            if (e.getEventType() == MouseEvent.MOUSE_CLICKED || e.getEventType() == GazeEvent.GAZE_ENTERED) {

                System.out.println("Image Clicked! BRAVO!");

                Animation animation = new Transition() {

                    {
                        setCycleDuration(Duration.millis(3000));
                        hboxFirst.getChildren().removeAll(imgView1, imgView2, imgView3);
                        hboxFirst.getChildren().add(imgView4);
                        String musicFileBravo =  System.getProperties().getProperty("user.home") + File.separator + "GazePlay" + File.separator + "files" + File.separator + "myGame"+File.separator+"applause.mp3";
                        File fSound = new File(musicFileBravo);

                        Media firstSound = new Media(fSound.toURI().toString());
                        MediaPlayer mediaPlayerBravo = new MediaPlayer(firstSound);
                        mediaPlayerBravo.play();
                    }

                    @Override
                    protected void interpolate(double frac) {
                        final int n = Math.round(3000 * (float) frac);

                    }
                };

                animation.play();

                animation.setOnFinished(new EventHandler<ActionEvent>() {


                    @Override
                    public void handle(ActionEvent actionEvent) {
                        hboxFirst.getChildren().removeAll(imgView4);
                        createGame(sceneFirst, hboxFirst);

                    }
                });

            }

        }
    };

}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:52,代碼來源:JeuAnimaux_handler.java

示例8: buildBravoEvent

import javafx.animation.Animation; //導入方法依賴的package包/類
private  EventHandler<Event> buildBravoEvent() {
    return new EventHandler<Event>() {
        @Override
        public void handle(Event e) {



            if (e.getEventType() == MouseEvent.MOUSE_CLICKED || e.getEventType() == GazeEvent.GAZE_ENTERED) {

                canvas.getChildren().removeAll(imgViewTriangle, imgViewSquare, imgViewTrapez);
                canvas.add(imgViewBravo, 3, 3);

                String musicFileBravo = "samplesAmela/sounds/applause.mp3";

                Media soundBravo = new Media(new File(musicFileBravo).toURI().toString());
                MediaPlayer mediaPlayerBravo = new MediaPlayer(soundBravo);
                mediaPlayerBravo.play();

                System.out.println("Image 1 Clicked! BRAVO!");

                Animation animation = new Transition() {

                    {
                        setCycleDuration(Duration.millis(5000));
                        canvas.getChildren().add(bubble);


                    }

                    @Override
                    protected void interpolate(double frac) {
                        final int n = Math.round(100 * (float) frac);

                    }

                };
                animation.play();
                animation.setOnFinished(new EventHandler<ActionEvent>() {


                    @Override
                    public void handle(ActionEvent actionEvent) {
                        canvas.getChildren().remove(imgViewBravo);
                        canvas.getChildren().remove(bubble);

                        count=0;
                        Image image = canvas.snapshot(new SnapshotParameters(), null);
                        ImagePattern pattern = new ImagePattern(image, 0, 0, 0, 0, false);
                        pattern=createGridPattern();
                    }
                });

            }

        }
    };

}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:59,代碼來源:Circles_points_handler.java


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