Difference between revisions of "Color.lerp"

From MiniScript Wiki
Jump to navigation Jump to search
(Initial write up of color.lerp)
 
 
Line 1: Line 1:
 
<c>color.lerp</c> is a method that implements linear interpolation between two colors. It is commonly used for changing colors over time or painting gradients.
 
<c>color.lerp</c> 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 ==
 
== Parameters ==
Line 29: Line 31:
 
</ms>
 
</ms>
  
See also [[Color]]
+
See also: [[Color]], [[MathUtil]]
  
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]

Latest revision as of 13:58, 29 March 2025

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