#How to use Stop() on JavaFX?

1 messages · Page 1 of 1 (latest)

verbal grove
#

Greetings everyone! I am trying to figure out how to utilize the Stop() method from JavaFX's Animation import.

My intention is that after the animation is done, x.stop() does its thing and resets itself.

Code below

``java
public void animationPlayer(){

    final Duration time = Duration.millis(500);
        
        TranslateTransition step1 = new TranslateTransition(time);
        step1.setByY(122);

        TranslateTransition step2 = new TranslateTransition(time);
        pcLabel.setText("ADD=1");
        step2.setByY(158);

        TranslateTransition step3 = new TranslateTransition(time);
        step3.setByX(-58);

        SequentialTransition animate = new SequentialTransition(pcLabel, step1,step2,step3);
        animate.play();
        animate.stop();
    }``
idle topazBOT
#

<@&987246487241105418> please have a look, thanks.

verbal grove
#

I realize that adding stop immediately after play causes the animation to just halt. So, how do I time this thing to reset if I wished?