API Reference › Color functions › Color.lerp
method

Color.lerp

Color.lerp(c0, c1, t) -> int

Interpolates each channel of c0 and c1 by the fixed amount t in 0.0..1.0, returning the blended color. Use it for gradients, fades between two tints, or a flash that returns to base.

Example

program Demo {
  handler DrawWorld phase Render {
    let c = Color.lerp(Color.Black, Color.White, 0.5)
    Screen.clear(c)
    Screen.show()
  }
}
← All symbols