本文整理匯總了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);
}
}
示例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);
}
}
}
}
示例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);
}
});
}
示例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();
}
示例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));
}
示例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 );
}
});
}
示例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);
}
});
}
}
};
}
示例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();
}
});
}
}
};
}