generativeart/example/example_circlegrid.go

29 lines
597 B
Go

package main
import (
"github.com/jdxyw/generativeart"
"github.com/jdxyw/generativeart/arts"
"image/color"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().Unix())
colors := []color.RGBA{
{0xED, 0x34, 0x41, 0xFF},
{0xFF, 0xD6, 0x30, 0xFF},
{0x32, 0x9F, 0xE3, 0xFF},
{0x15, 0x42, 0x96, 0xFF},
{0x00, 0x00, 0x00, 0xFF},
{0xFF, 0xFF, 0xFF, 0xFF},
}
c := generativeart.NewCanva(500, 500)
c.SetBackground(color.RGBA{0xDF, 0xEB, 0xF5, 0xFF})
c.FillBackground()
c.SetColorSchema(colors)
c.SetLineWidth(2.0)
c.Draw(arts.NewCircleGrid(4, 6))
c.ToPNG("circlegrid.png")
}