generativeart/example/example_julia.go

26 lines
402 B
Go
Raw Normal View History

2021-03-02 05:10:14 +00:00
package main
import (
"generativeart"
"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-03 09:38:34 +00:00
c := generativeart.NewCanva(500, 500, 1.5, 1.5)
2021-03-02 05:10:14 +00:00
c.SetIterations(800)
c.SetColorSchema(generativeart.Viridis)
c.FillBackground()
c.Draw(generativeart.NewJulia(julia1, 40))
c.ToPNG("julia.png")
}