generativeart/example/example_julia.go

28 lines
482 B
Go
Raw Permalink Normal View History

2021-03-02 05:10:14 +00:00
package main
import (
2021-03-03 16:48:26 +00:00
"github.com/jdxyw/generativeart"
"github.com/jdxyw/generativeart/arts"
"github.com/jdxyw/generativeart/common"
2021-03-02 05:10:14 +00:00
"math/rand"
"time"
)
func julia1(z complex128) complex128 {
c := complex(-0.1, 0.651)
z = z*z + c
return z
}
func main() {
rand.Seed(time.Now().Unix())
2021-03-04 02:46:41 +00:00
c := generativeart.NewCanva(500, 500)
2021-03-02 05:10:14 +00:00
c.SetIterations(800)
2021-03-30 02:49:33 +00:00
c.SetColorSchema(common.Citrus)
2021-03-02 05:10:14 +00:00
c.FillBackground()
c.Draw(arts.NewJulia(julia1, 40, 1.5, 1.5))
2021-03-02 05:10:14 +00:00
c.ToPNG("julia.png")
}