public class BubbleColorAnimation extends Object
BubbleColorAnimation has the ability to convert one or many color-pairs smoothly from source
to destination color. It basically is a map storing String-Color pairs.
Clients have to call putColor(String, Color) to start an animation. They
can call getColor(String) any time to get the current intermediate color. Adding a task
will allow a client to be informed whenever the colors change.duration milliseconds.| Constructor and Description |
|---|
BubbleColorAnimation()
Creates a new animation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTask(Runnable runnable)
Adds a task to this animation.
|
Color |
getColor(String key)
Gets the current color of the pair
key. |
int |
getDuration()
Gets the length of one transformation.
|
void |
kick()
Immediately puts all colors to their final state and stops the animation.
|
protected void |
pulse()
Called when the animation has to perform another step.
|
void |
putColor(String key,
Color color)
If there is already a color stored under
key, then a new animation
is started that smoothly changes the color key from its current value
to color. |
void |
putColors(String key,
Color source,
Color destination)
Sets a color-pair.
|
void |
removeTask(Runnable runnable)
Removes a task which was earlier added to this animation.
|
void |
setDuration(int duration)
Sets the length of one transformation.
|
protected void |
start()
Starts the animation if it is not yet running.
|
void |
stop()
Stops the animation immediately, possibly leaving the animation
in an unfinished state.
|
public void putColors(String key, Color source, Color destination)
destination is shown
after maximal duration milliseconds. This method
does not start an animation, it just modifies an existing transition.key - the key of the pairsource - where the animation startsdestination - the destination of the animationpublic void putColor(String key, Color color)
key, then a new animation
is started that smoothly changes the color key from its current value
to color. If no color is stored, then color is just set
without starting an animation.key - the key of the paircolor - the destination of the animation, can be nullpublic Color getColor(String key)
key.key - the key of the pairnullpublic void addTask(Runnable runnable)
runnable - the task to executepublic void removeTask(Runnable runnable)
runnable - the task to removepublic void setDuration(int duration)
duration - the duration in millisecondspublic int getDuration()
public void stop()
public void kick()
protected void start()
protected void pulse()
Copyright © 2017 Docking Frames. All rights reserved.