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


Java Animation.play方法代碼示例

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


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

示例1: start

import javafx.animation.Animation; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) {
	GameChooser gameManager = new GameChooser(primaryStage);		
	primaryStage.setScene(makeScene());
	primaryStage.setFullScreenExitHint("");
	primaryStage.setFullScreenExitKeyCombination(null);
	primaryStage.show();
	primaryStage.setFullScreen(true);
       Animation myAnimation = makeAnimation(myActor, 100, 200, 100);
       // start animation
       myAnimation.play();
       
       Animation myAnimation1 = makeAnimation(myActor1, 100, 200, 100);
       // start animation
       myAnimation1.play();
       
       Animation myAnimation2 = makeAnimation(myActor2,100,240,140);
       // start animation
       myAnimation2.play();
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:21,代碼來源:LoaderTester.java

示例2: getImageView

import javafx.animation.Animation; //導入方法依賴的package包/類
public ImageView getImageView(int seed) {
	final ImageView imageView = new ImageView();

	int[] numberList = new int[6];
	for(int i = 0; i < NUMBER_OF_IMAGE; i++){
		numberList[i] = i;
	}
	shuffleArray(seed, numberList);
	List<Image> list = new ArrayList<>();

	for(int j =0; j < NUMBER_OF_IMAGE; j++){
		list.add(getImage(numberList[j]));
	}

	final Animation animation = new ImageAnimation(list, imageView, Duration.millis(5000), WIDTH, HEIGHT);
	animation.setCycleCount(Animation.INDEFINITE);
	animation.play();
	return imageView;
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:20,代碼來源:AnimationImage.java

示例3: shirnkDetailsAction

import javafx.animation.Animation; //導入方法依賴的package包/類
@FXML
private void shirnkDetailsAction(ActionEvent event)
{
    if ("Cancel".equals(StudentDetailController.editCancelButton.getText()))
    {
        StudentDetailController.editCancelButtonAction(event);
    }

    final Animation animation = new Transition()
    {
        
        {
            setCycleDuration(Duration.millis(800));
        }

        @Override
        protected void interpolate(double frac)
        {
            SplitPaneMain.setDividerPosition(0, SplitPaneMain.getDividerPositions()[0]-frac);
        }
    };
    animation.play();
}
 
開發者ID:pranavjindal999,項目名稱:Hostel-Management-System,代碼行數:24,代碼來源:MainProgramSceneController.java

示例4: start

import javafx.animation.Animation; //導入方法依賴的package包/類
public void start(Stage primaryStage) {
    primaryStage.setTitle("The Horse in Motion");

    final ImageView imageView = new ImageView(IMAGE);
    imageView.setViewport(new Rectangle2D(OFFSET_X, OFFSET_Y, WIDTH, HEIGHT));

    final Animation animation = new SpriteAnimation(
        imageView,
        Duration.millis(1000),
        COUNT, COLUMNS,
        OFFSET_X, OFFSET_Y,
        WIDTH, HEIGHT
    );
    animation.setCycleCount(Animation.INDEFINITE);
    animation.play();

    primaryStage.setScene(new Scene(new Group(imageView)));
    primaryStage.show();
}
 
開發者ID:ErikHumphrey,項目名稱:ics4u,代碼行數:20,代碼來源:Game.java

示例5: moveDataWithAnimation

import javafx.animation.Animation; //導入方法依賴的package包/類
private void moveDataWithAnimation(final TableView<Person> sourceTable,
		final TableView<Person> destinationTable,
		final Pane commonTableAncestor, final TableRow<Person> row) {
	// Create imageview to display snapshot of row:
	final ImageView imageView = createImageView(row);
	// Start animation at current row:
	final Point2D animationStartPoint = row.localToScene(new Point2D(0, 0)); // relative to Scene
	final Point2D animationEndPoint = computeAnimationEndPoint(destinationTable); // relative to Scene
	// Set start location
	final Point2D startInRoot = commonTableAncestor.sceneToLocal(animationStartPoint); // relative to commonTableAncestor
	imageView.relocate(startInRoot.getX(), startInRoot.getY());
	// Create animation
	final Animation transition = createAndConfigureAnimation(
			sourceTable, destinationTable, commonTableAncestor, row,
			imageView, animationStartPoint, animationEndPoint);
	// add animated image to display
	commonTableAncestor.getChildren().add(imageView);
	// start animation
	transition.play();
}
 
開發者ID:mars-sim,項目名稱:mars-sim,代碼行數:21,代碼來源:AnimatedTableRow.java

示例6: 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

示例7: start

import javafx.animation.Animation; //導入方法依賴的package包/類
public void start(Stage primaryStage) {
    primaryStage.setTitle("The Horse in Motion");

    final ImageView imageView = new ImageView(IMAGE);
    imageView.setViewport(new Rectangle2D(OFFSET_X, OFFSET_Y, WIDTH, HEIGHT));

    final Animation animation = new SpriteAnimation(
            imageView,
            Duration.millis(600),
            COUNT, COLUMNS,
            OFFSET_X, OFFSET_Y,
            WIDTH, HEIGHT
    );
    animation.setCycleCount(Animation.INDEFINITE);
    animation.play();

    primaryStage.setScene(new Scene(new Group(imageView)));
    primaryStage.show();
}
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:20,代碼來源:JavaFX_SpriteAnimation.java

示例8: 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

示例9: getImageView

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

		final ImageView imageView = new ImageView();		
		List<Image> list = getSpriteImage();

		final Animation animation = new ImageAnimation(
				list,
				imageView,
				Duration.millis(1000),
				WIDTH, HEIGHT
				);
		animation.setCycleCount(Animation.INDEFINITE);
		animation.play();	
		return imageView;
	}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:16,代碼來源:SpriteAnimation.java

示例10: 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

示例11: 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

示例12: animate

import javafx.animation.Animation; //導入方法依賴的package包/類
@MustCallOnJavaFXThread
void animate( Color color ) {
    Animation animation = new BackgroundTransition( color );
    animation.play();
}
 
開發者ID:renatoathaydes,項目名稱:LogFX,代碼行數:6,代碼來源:LogLine.java

示例13: 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

示例14: 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

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