Package nl.colorize.util.swing
Class AnimatedColor
java.lang.Object
java.awt.Color
nl.colorize.util.swing.AnimatedColor
- All Implemented Interfaces:
Paint
,Transparency
,Serializable
,Animatable
Color with red, green, blue, and alpha components that change over time.
- See Also:
-
Field Summary
Fields inherited from class java.awt.Color
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
-
Constructor Summary
ConstructorDescriptionAnimatedColor
(Color startColor) Creates a newAnimatedColor
that will start out with the RGBA values ofstartColor
.AnimatedColor
(Color startColor, Color endColor, float duration) Creates a new color with the specified RGBA values.AnimatedColor
(Color startColor, Interpolation interpolationMethod) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addKeyFrame
(float time, Color rgba) Adds a key frame that describes the RGBA values of this color at the specified point in time.void
end()
int
getAlpha()
int
getBlue()
int
getGreen()
int
getRed()
int
getRGB()
int
hashCode()
void
onFrame
(float deltaTime) Called every frame update while the animation is active.void
reset()
protected void
setPlayhead
(float time) Methods inherited from class java.awt.Color
brighter, createContext, darker, decode, equals, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getHSBColor, getRGBColorComponents, getRGBComponents, getTransparency, HSBtoRGB, RGBtoHSB, toString
-
Constructor Details
-
AnimatedColor
Creates a newAnimatedColor
that will start out with the RGBA values ofstartColor
. Animation can be added to the color by adding key frames. -
AnimatedColor
-
AnimatedColor
Creates a new color with the specified RGBA values. The actual appearance of the color will be determined by the state of the animation.
-
-
Method Details
-
addKeyFrame
Adds a key frame that describes the RGBA values of this color at the specified point in time. -
onFrame
public void onFrame(float deltaTime) Description copied from interface:Animatable
Called every frame update while the animation is active.- Specified by:
onFrame
in interfaceAnimatable
- Parameters:
deltaTime
- Time since the last frame update, in seconds.
-
setPlayhead
protected void setPlayhead(float time) -
reset
public void reset() -
end
public void end() -
getRed
public int getRed() -
getGreen
public int getGreen() -
getBlue
public int getBlue() -
getAlpha
public int getAlpha() -
getRGB
public int getRGB() -
hashCode
public int hashCode()
-