Bonjour,

C'est encore moi. J'avance petit à petit dans mon projet, mais je suis face à un nouveau problème.
J'ai mis en place une animation qui déplace un vaisseau jusqu'à un point. J'aimerai pouvoir le supprimer une fois l'animation terminée. Mon code est le suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
	this.target = planet;
		double destX = planet.getShape().getCenterX();
		double destY = planet.getShape().getCenterY();
 
		System.out.println("triangle, x = " + super.rect.getLayoutX() + " | y = " + super.rect.getLayoutY());
 
		final Path path = new Path( 
				new MoveTo(0, 0),
                new LineTo(destX - super.rect.getLayoutX(), destY - super.rect.getLayoutY())
               ); 
		final PathTransition pathAnimation = new PathTransition(Duration.seconds(2), path, super.rect); 
        pathAnimation.setInterpolator(Interpolator.LINEAR); 
        pathAnimation.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
        pathAnimation.play();
J'aimerai pouvoir supprimer une fois le pathAnimation.play() terminée. J'ai essaye de faire un root.getChildren().remove(mon vaisseau). Mais il supprime mon vaisseau avant même que l'animation commence. Connaissez vous une manière d'attendre que l'animation soit terminée ?

Merci d'avance !

Ben.