Class Animation.Builder
- Enclosing class:
Animation
Builder in order to construct animations comfortable.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the animation.ledOff
(int index) Turns the LED or digital output on the Kart at the given index off.ledOn
(int index) Turns the LED or digital output on the Kart at the given index on.Performs a custom action that can be passed as Runnable implementation to the builder method call.Tests repeatedly the given condition until the condition returns true, then the animation is continued.Tests repeatedly the given condition until the condition returns true, then the animation is continued.wait
(int milliseconds) Waits the given amount of milliseconds before the next step of the animation will be executed.
-
Method Details
-
ledOn
Turns the LED or digital output on the Kart at the given index on.
- Parameters:
index
- Index of the LED/Output to set to on (0..3).- Returns:
- Reference to the builder in order to chain the method calls.
- Throws:
IndexOutOfBoundsException
- If the LED index is outside the range 0..3.
-
ledOff
Turns the LED or digital output on the Kart at the given index off.
- Parameters:
index
- Index of the LED/Output to set to off (0..3).- Returns:
- Reference to the builder in order to chain the method calls.
- Throws:
IndexOutOfBoundsException
- If the LED index is outside the range 0..3.
-
wait
Waits the given amount of milliseconds before the next step of the animation will be executed.
- Parameters:
milliseconds
- Number of milliseconds to wait before executing the next step.- Returns:
- Reference to the builder in order to chain the method calls.
-
perform
Performs a custom action that can be passed as Runnable implementation to the builder method call.
- Parameters:
action
- Runnable implementation that will be executed at the given animation step.- Returns:
- Reference to the builder in order to chain the method calls.
-
until
Tests repeatedly the given condition until the condition returns true, then the animation is continued. The default poll interval (the interval the condition is tested) is 100ms, thus a frequency of about 10 Hz.
- Parameters:
condition
- Callable implementation that will be executed at the given animation step as long as it does not return true.- Returns:
- Reference to the builder in order to chain the method calls.
-
until
Tests repeatedly the given condition until the condition returns true, then the animation is continued. The poll interval can be specified in milliseconds.
- Parameters:
condition
- Callable implementation that will be executed at the given animation step as long as it does not return true.pollInterval
- Interval at which the condition is tested.- Returns:
- Reference to the builder in order to chain the method calls.
-
build
Builds the animation. This method will finalize the Animation instance building process and returns a reference to the newly build animation.
- Returns:
- Animation that was created using the builder.
-