summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 5 insertions, 1 deletions
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