You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.1 KiB

  1. package main
  2. import (
  3. "git.aiterp.net/lucifer3/server/internal/color"
  4. "image"
  5. color2 "image/color"
  6. "image/png"
  7. "math"
  8. "os"
  9. )
  10. func main() {
  11. img := image.NewRGBA(image.Rect(0, 0, 1000, 1000))
  12. for y := 0; y < 1000; y += 1 {
  13. for x := 0; x < 1000; x += 1 {
  14. vecX := float64(x-500) / 500.0
  15. vecY := float64(y-500) / 500.0
  16. dist := math.Sqrt(vecX*vecX + vecY*vecY)
  17. angle := math.Mod((math.Atan2(vecY/dist, vecX/dist)*(180/math.Pi))+360+90, 360)
  18. if dist >= 0.9 && dist < 1 && angle > 2.5 && angle < 357.5 {
  19. k := 1000 + int(11000*((angle-2.5)/355))
  20. c := color.Color{K: &k}
  21. rgb, _ := c.ToRGB()
  22. img.Set(x, y, color2.RGBA{
  23. R: uint8(rgb.RGB.Red * 255.0),
  24. G: uint8(rgb.RGB.Green * 255.0),
  25. B: uint8(rgb.RGB.Blue * 255.0),
  26. A: 255,
  27. })
  28. } else if dist < 0.85 {
  29. rgb := (color.HueSat{Hue: math.Mod(angle+180, 360), Sat: dist / 0.85}).ToRGB()
  30. img.Set(x, y, color2.RGBA{
  31. R: uint8(rgb.Red * 255.0),
  32. G: uint8(rgb.Green * 255.0),
  33. B: uint8(rgb.Blue * 255.0),
  34. A: 255,
  35. })
  36. } else {
  37. img.Set(x, y, color2.RGBA{R: 0, G: 0, B: 0, A: 0})
  38. }
  39. }
  40. }
  41. _ = png.Encode(os.Stdout, img)
  42. }