Color.lerp

From MiniScript Wiki
Revision as of 11:39, 9 July 2021 by Shellrider (talk | contribs) (Initial write up of color.lerp)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

color.lerp is a method that implements linear interpolation between two colors. It is commonly used for changing colors over time or painting gradients.

Parameters

The method has this signature: color.lerp c1, c2, t

Parameter Description
c1 First color in hexcolor format
c2 Second color in hexcolor format
t Variable for how far to interpolate between the two colors (t <= 0 retunrs c1, t >= 0 returns c2, 0 < t < 1 returns color inbetween)

Example

color.lerp color.red, color.blue, 0
 #FF0000FF
color.lerp color.red, color.blue, 1
 #0000FFFF
color.lerp color.red, color.blue, 0.5
 #7F007FFF
color.lerp color.red, color.blue, 0.25
 #BF003FFF

See also Color