Color.lerp

From MiniScript Wiki
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.

(The term "lerp" is short for "linear interpolate".)

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, MathUtil