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

package main
import (
"git.aiterp.net/lucifer3/server/internal/color"
"image"
color2 "image/color"
"image/png"
"math"
"os"
)
func main() {
img := image.NewRGBA(image.Rect(0, 0, 1000, 1000))
for y := 0; y < 1000; y += 1 {
for x := 0; x < 1000; x += 1 {
vecX := float64(x-500) / 500.0
vecY := float64(y-500) / 500.0
dist := math.Sqrt(vecX*vecX + vecY*vecY)
angle := math.Mod((math.Atan2(vecY/dist, vecX/dist)*(180/math.Pi))+360+90, 360)
if dist >= 0.9 && dist < 1 && angle > 2.5 && angle < 357.5 {
k := 1000 + int(11000*((angle-2.5)/355))
c := color.Color{K: &k}
rgb, _ := c.ToRGB()
img.Set(x, y, color2.RGBA{
R: uint8(rgb.RGB.Red * 255.0),
G: uint8(rgb.RGB.Green * 255.0),
B: uint8(rgb.RGB.Blue * 255.0),
A: 255,
})
} else if dist < 0.85 {
rgb := (color.HueSat{Hue: math.Mod(angle+180, 360), Sat: dist / 0.85}).ToRGB()
img.Set(x, y, color2.RGBA{
R: uint8(rgb.Red * 255.0),
G: uint8(rgb.Green * 255.0),
B: uint8(rgb.Blue * 255.0),
A: 255,
})
} else {
img.Set(x, y, color2.RGBA{R: 0, G: 0, B: 0, A: 0})
}
}
}
_ = png.Encode(os.Stdout, img)
}