Class PolyColor.Chroma

  • All Implemented Interfaces:
    kotlin.Cloneable

    
    public final class PolyColor.Chroma
    extends PolyColor.Animated
                        

    A color that changes over time, in an endless cycle. You can use the saturation and brightness fields to set the tone of the chroma. Some examples:

    brightness = 0.2f, saturation = 0.8f -> dark chroma

    brightness = 0.8f, saturation = 0.8f -> less offensive chroma tone

    • Constructor Detail

      • PolyColor.Chroma

        PolyColor.Chroma(Long speedNanos, Float brightness, Float saturation, Float alpha, Float initialHue)
        Parameters:
        initialHue - the initial hue of the color, being any float value.
      • PolyColor.Chroma

        PolyColor.Chroma(Long speedNanos, Float brightness, Float saturation, Float alpha)
      • PolyColor.Chroma

        PolyColor.Chroma(Long speedNanos, Float brightness, Float saturation)
      • PolyColor.Chroma

        PolyColor.Chroma(Long speedNanos, Float brightness)
      • PolyColor.Chroma

        PolyColor.Chroma(Long speedNanos)
      • PolyColor.Chroma

        PolyColor.Chroma()
    • Method Detail

      • getSpeedNanos

         final Long getSpeedNanos()

        the speed of this color, in nanoseconds.

        The speed refers to the amount of time it takes for this color to complete one cycle, e.g. from red, through to blue, through to green, then back to red.

      • setSpeedNanos

         final Unit setSpeedNanos(Long speedNanos)

        the speed of this color, in nanoseconds.

        The speed refers to the amount of time it takes for this color to complete one cycle, e.g. from red, through to blue, through to green, then back to red.

      • recolor

         Unit recolor(PolyColor target, Animation animation)

        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:
        animation - animation to use.
      • freeze

         final PolyColor.Animated freeze()

        Convert this chroma color to a mutable color, which is a snapshot of this color at the time of calling this method.

        Since:

        0.19.1

      • 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