java.lang.Object
io.github.palexdev.materialfx.utils.AnimationUtils.PauseBuilder
- Enclosing class:
- AnimationUtils
Builder class to easily create a
PauseTransition with fluent api.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AnimationUtils.PauseBuilderbuild()voidrunWhile(BooleanExpression booleanExpression, Runnable retryAction, Runnable onSuccessAction) This method can be considered an utility.voidrunWhile(BooleanExpression booleanExpression, Runnable retryAction, Runnable onSuccessAction, int maxRetryCount) Same method asrunWhile(BooleanExpression, Runnable, Runnable)but instead of running until the given expression is true, it is limited to a maximum number of retries.setDelay(double millis) setDuration(double millis) CallssetDuration(Duration)by converting the given millis value withDuration.millis(double).setDuration(Duration duration) Sets the pause transition duration.setOnFinished(EventHandler<ActionEvent> onFinished) Sets the action to perform when the pause transition ends.
-
Constructor Details
-
PauseBuilder
public PauseBuilder()
-
-
Method Details
-
build
- Returns:
- a new PauseBuilder instance. Equivalent to calling the constructor, it's just a way to omit the new keyword
-
setDelay
-
setDelay
-
setDuration
Sets the pause transition duration. -
setDuration
CallssetDuration(Duration)by converting the given millis value withDuration.millis(double). -
setOnFinished
Sets the action to perform when the pause transition ends. -
getAnimation
- Returns:
- the instance of the PauseTransition
-
runWhile
public void runWhile(BooleanExpression booleanExpression, Runnable retryAction, Runnable onSuccessAction) This method can be considered an utility. APauseTransitionwith the previously set duration runs while the given boolean boolean expression is false. When the expression is evaluated and it is false the given retryAction is run and the transition is restarted. When it ends the expression is re-evaluated. When the expression becomes true the onSuccessAction is run. So you have aPauseTransitionthat runs every tot unit of time and stops only when the given expression is true.- Parameters:
booleanExpression- the expression to check at a fixed time rateretryAction- the action to perform when the expression is falseonSuccessAction- the action to perform when the expression is true
-
runWhile
public void runWhile(BooleanExpression booleanExpression, Runnable retryAction, Runnable onSuccessAction, int maxRetryCount) Same method asrunWhile(BooleanExpression, Runnable, Runnable)but instead of running until the given expression is true, it is limited to a maximum number of retries.- Parameters:
maxRetryCount- the max number of times the transition can be restarted
-