Gradient

class Gradient @JvmOverloads constructor(color1: Color, color2: Color, val type: PolyColor.Gradient.Type = Type.TopLeftToBottomRight) : PolyColor.Animated

A gradient color.

Constructors

Link copied to clipboard
constructor(color1: Color, color2: Color, type: PolyColor.Gradient.Type = Type.TopLeftToBottomRight)

Types

Link copied to clipboard
sealed interface Type

Properties

Link copied to clipboard
@get:JvmName(name = "alpha")
val a: Int

alpha value of this color, from 0 to 255

Link copied to clipboard

The alpha of this color. Clamped between 0f..1f.

Link copied to clipboard
@get:JvmName(name = "getARGB")
var argb: Int

return an integer representation of this color. Utilizes bit-shifts to store the color as one 32-bit integer, like so:

Link copied to clipboard
@get:JvmName(name = "getARGB1")
val argb1: Int
Link copied to clipboard
@get:JvmName(name = "getARGB2")
val argb2: Int
Link copied to clipboard
@get:JvmName(name = "blue")
val b: Int

blue value of this color, from 0 to 255

Link copied to clipboard

The brightness of this color. Clamped between 0f..1f.

Link copied to clipboard

WARNING: the following code will NOT behave as expected:

Link copied to clipboard
Link copied to clipboard

Set this to true to update the argb value.

Link copied to clipboard
@get:JvmName(name = "green")
val g: Int

green value of this color, from 0 to 255

Link copied to clipboard
var hue: Float

The hue of this color. Can be any value, but is mod 360, so values are always between 0 and 360.

Link copied to clipboard
@get:JvmName(name = "red")
val r: Int

red value of this color, from 0 to 255

Link copied to clipboard

The saturation of this color. Clamped between 0f..1f.

Link copied to clipboard
open override val transparent: Boolean
Link copied to clipboard
Link copied to clipboard
open override val updating: Boolean

return if the color is still updating (i.e. it has an animation to finish)

Functions

Link copied to clipboard
open override fun clone(): PolyColor.Gradient
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
operator fun get(index: Int): Color
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
@ApiStatus.Experimental
fun <S : Drawable> PolyColor.makeChroma(speedNanos: Ref.LongRef = 5.seconds.toChromaSpeed()): DrawableOp

Make the given color chroma, meaning it will change its hue over time.

Link copied to clipboard
open override fun recolor(target: Color, animation: Animation?)

Deprecated, see Component.recolor for how to animate gradients.

fun recolor(whichColor: Int, target: Color, animation: Animation? = null)

Animated.recolor this gradient color.

Link copied to clipboard
operator fun set(index: Int, color: Color)
Link copied to clipboard
fun take(color: Color): Color
Link copied to clipboard
open override fun toAnimatable(): PolyColor.Animated
Link copied to clipboard

Return a static java Color object of this color at the instant this method is called.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun update(deltaTimeNanos: Long): Boolean

update the color animation, if present. After, the animation is cleared, and the color becomes static again.