Package org.polyfrost.polyui.color
Class Color.Animated
-
- All Implemented Interfaces:
-
kotlin.Cloneable
public class Color.Animated extends Color
An animatable version of Color, that supports recoloring with animations.
-
-
Field Summary
Fields Modifier and Type Field Description private final BooleanalwaysUpdatesprivate final Booleanupdatingprivate Floathueprivate Floatsaturationprivate Floatbrightnessprivate Floatalphaprivate transient Booleandirtyprivate transient Integerargbprivate final Integerrprivate final Integergprivate final Integerbprivate final Integera
-
Constructor Summary
Constructors Constructor Description Color.Animated(Float hue, Float saturation, Float brightness, Float alpha)
-
Method Summary
Modifier and Type Method Description BooleangetAlwaysUpdates()BooleangetUpdating()Color.AnimatedtoAnimatable()Unitrecolor(Color target, Animation.Type type, Long durationNanos)recolor this color to the target color, with the given animation type and duration. Booleanupdate(Long deltaTimeNanos)update the color animation, if present. Color.Animatedclone()-
Methods inherited from class org.polyfrost.polyui.color.Color
equals, getA, getARGB, getAlpha, getB, getBrightness, getDirty, getG, getHue, getR, getSaturation, hashCode, setAlpha, setArgb, setBrightness, setDirty, setHue, setSaturation, take, toString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getAlwaysUpdates
Boolean getAlwaysUpdates()
-
getUpdating
Boolean getUpdating()
-
toAnimatable
@Deprecated(message = "This would convert an animatable color to an animatable one.", replaceWith = @ReplaceWith(imports = {}, expression = "clone()")) Color.Animated toAnimatable()
- Returns:
a new, animatable version of this color
-
recolor
Unit recolor(Color target, Animation.Type type, Long durationNanos)
recolor this color to the target color, with the given animation type and duration.
make sure to check if the color is a gradient, as this method may not have the expected result!
- Parameters:
type- animation type.
-
update
Boolean update(Long deltaTimeNanos)
update the color animation, if present. After, the animation is cleared, and the color becomes static again.
- Returns:
true if the animation finished on this tick, false if otherwise
-
clone
Color.Animated clone()
-
-
-
-