Is there a way to know if an AnimationTimer
is running or not? I would like to toggle a pause menu like this:
setOnKeyTyped(event -> {
switch (event.getCode()) {
case SPACE:
if (animationTimer.isRunning()) { // What should I put here?
animationTimer.stop();
}
else {
animationTimer.start();
}
break;
default:
break;
}
}