generativeart/example/example_oceanfish.go

32 lines
657 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{
// {0x05, 0x1F, 0x34, 0xFF},
// {0x02, 0x74, 0x95, 0xFF},
// {0x01, 0xA9, 0xC1, 0xFF},
// {0xBA, 0xD6, 0xDB, 0xFF},
// {0xF4, 0xF5, 0xF5, 0xFF},
//}
colors := []color.RGBA{
{0xCF, 0x2B, 0x34, 0xFF},
{0xF0, 0x8F, 0x46, 0xFF},
{0xF0, 0xC1, 0x29, 0xFF},
{0x19, 0x6E, 0x94, 0xFF},
{0x35, 0x3A, 0x57, 0xFF},
}
c := generativeart.NewCanva(500, 500)
c.SetColorSchema(colors)
c.Draw(arts.NewOceanFish(100, 8))
c.ToPNG("oceanfish.png")
}