Luawe All pages

gradient

Gradients: colors and their alpha along a line, from 0 to 1, as a Gradient child and particles have them. A gradient is a value like a color: it can't be changed, and functions give new ones.

gradient.newfunction

gradient.new(keys: table): gradient

A gradient from its keypoints, each written [time] = { color, alpha }: its time from 0 to 1, its color, and its alpha (1 solid, 0 gone): gradient.new({ [0] = { color.red, 1 }, [1] = { color.blue, 0.5 } }). A color alone has alpha 1 ([0.5] = color.white), a list of colors is spread evenly (gradient.new({ color.red, color.blue })), and a color may be a cat.Theme item, which the gradient then follows. 16 keypoints at most.

ValueType
keystable

Gives: gradient.

gradient.lerpfunction

gradient.lerp(a: gradient, b: gradient, t: number): gradient

The same as a:lerp(b, t).

ValueType
agradient
bgradient
tnumber

Gives: gradient.

gradient.keysfunction

g.keys: list of table

Its keypoints, in order: a list of tables with time, color and alpha. (A new list each time: changing it changes nothing.)

gradient:colorAtfunction

g:colorAt(time: number): color

Its color at a time, from 0 to 1.

ValueType
timenumber

Gives: color.

gradient:alphaAtfunction

g:alphaAt(time: number): number

Its alpha at a time, from 0 to 1.

ValueType
timenumber

Gives: number.

gradient:reversefunction

g:reverse(): gradient

A new gradient: the same keypoints the other way round.

Gives: gradient.

gradient:lerpfunction

g:lerp(other: gradient, t: number): gradient

A gradient between this one (t = 0) and the other (t = 1). With as many keypoints as each other, each keypoint glides to the other's, its time too. t is kept from 0 to 1.

ValueType
othergradient
tnumber

Gives: gradient.