From 6118dce2db22e8461d9e21c70c330674f5fe6ca0 Mon Sep 17 00:00:00 2001 From: "Brandon C. Irizarry" Date: Thu, 5 Mar 2026 21:29:01 -0500 Subject: feat: make the lissajous design flash in a few random colors --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 7bdf3f3..b73f5fb 100644 --- a/main.go +++ b/main.go @@ -13,6 +13,8 @@ import ( var palette = []color.Color{ color.Black, color.RGBA{0x00, 0xff, 0x00, 0xff}, + color.RGBA{0xff, 0x00, 0x00, 0xff}, + color.RGBA{0x00, 0x00, 0xff, 0xff}, } const ( @@ -52,10 +54,12 @@ func newImage(size, cycles int, phase, res, freq float64) *image.Paletted { rect := image.Rect(0, 0, 2*size+1, 2*size+1) img := image.NewPaletted(rect, palette) + randIndex := 1 + uint8(rand.IntN(len(palette)-1)) + for t := 0.0; t < float64(cycles)*2*math.Pi; t += res { x := math.Sin(t) y := math.Sin(t*freq + phase) - img.SetColorIndex(size+int(x*float64(size)+0.5), size+int(y*float64(size)+0.5), foregroundIndex) + img.SetColorIndex(size+int(x*float64(size)+0.5), size+int(y*float64(size)+0.5), randIndex) } return img -- cgit v1.2.3