ColorUtil.gd 277 B

12345678910111213
  1. class_name ColorUtil
  2. static func color_from_life(n: int) -> Color:
  3. var x = float(n % 256) / 255
  4. if n < 256:
  5. return Color(x, 1.0, 1.0 - x)
  6. elif n < 512:
  7. return Color(1.0, 1.0 - x, x)
  8. elif n < 768:
  9. return Color(1.0, 0.0, 1.0 - x)
  10. else:
  11. return Color(1.0, 0.0, 0.0)