Skip to content

Instantly share code, notes, and snippets.

@xiaoyunyang
Created February 4, 2019 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiaoyunyang/2ba928d0fa4e97b47addb3cd95770c25 to your computer and use it in GitHub Desktop.
Save xiaoyunyang/2ba928d0fa4e97b47addb3cd95770c25 to your computer and use it in GitHub Desktop.
package main
import (
"math/rand"
"os"
svg "github.com/ajstarks/svgo"
)
var (
canvas = svg.New(os.Stdout)
width = 1000
height = 500
)
func main() {
canvas.Start(width, height)
canvas.Gstyle("fill:#22264b")
var color string
radius := 90
step := 8
for i := 0; i < 200; i++ {
if i%4 == 0 {
color = "#e6cf8b"
} else {
color = "#b56969"
}
x, y := rand.Intn(width), rand.Intn(height)
for r, nc := radius, 0; nc < 10; nc++ {
canvas.Circle(x, y, r, "stroke:"+color)
r -= step
}
}
canvas.Gend()
canvas.End()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment