chickadee » sdl2 » color-lerp!

color-lerp color1 color2 tprocedure
color-lerp! color1 color2 t #!optional destprocedure

Efficient linear interpolation (or extrapolation) between color1 and color2. sdl2:color can only hold integer values, so the results will be truncated to integers. The results will be clamped to the range 0 to 255.

t is the interpolation factor (a float). Values of t between 0 and 1 will interpolate between color1 and color2. Values of t less that 0 will extrapolate beyond color1 (moving away from color2). Values greater that 1 will extrapolate beyond color2 (moving away from color1).

  • color-lerp returns a new managed sdl2:color.
  • color-lerp! modifies and returns dest. If dest is omitted, color1 is modified and returned.

These procedures are available in sdl2 egg version 0.2.0 and higher.