From f23d235c0655a1de780647c00fd40246ea138167 Mon Sep 17 00:00:00 2001 From: Yongwei Xing Date: Mon, 8 Mar 2021 15:56:32 +0800 Subject: [PATCH] add doc.md --- README.md | 13 ++++++-- docs/doc.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 docs/doc.md diff --git a/README.md b/README.md index 4dd8f7d..697d68d 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ For these kinds of art, the package provides as many as parameters to control th ## Install -The go version I used is go 1.16. +The go version I used is `Go 1.16`. ```bash go get github.com/jdxyw/generativeart @@ -57,6 +57,13 @@ NewColorCircle2(circleNum int) NewCircleGrid(circleNumMin, circleNumMax int) ``` +## Docs + +You could find the docs in the [doc](./docs). + +## Examples + +You could find examples for all types under [example](./example). ## General Options ```go @@ -73,7 +80,7 @@ type Options struct { The `Options` is a global option for the whole `canva`. It includes those general parameters used by different kinds of types, such as `background`, `lineColor`, and `colorScheme`. -For those parameters specified for different kinds of art type, they have their own `struct`. +For those parameters specified for different kinds of art types, they have their own `struct`. ## Usage and example ### Junas @@ -115,7 +122,7 @@ func main() { ![](images/randomshape.png) -### Color Circle +### Color Circle2 ```go func main() { diff --git a/docs/doc.md b/docs/doc.md new file mode 100644 index 0000000..72e46ec --- /dev/null +++ b/docs/doc.md @@ -0,0 +1,87 @@ +## Color Circle 2 + +`Color Circle2` is version 2 of `Color Circle`. It still draws circle and point cloud. + +### parameters + +- circleNum: The number of circle in this drawing. + +```go +cc := generativeart.NewColorCircle2(30) +``` + +![](../images/colorcircle2.png) + +## Dot Line + +`dot line` would draw images with short dot and short. The short lines would compose as a big circle. + +### parameters + +- n: The number of element in this image. +- ras/canv: Control the appearance of this image. +- randColor: Use the the specified color or random colors. + +```go +dl := generativeart.NewDotLine(100, 20, 50, false) +``` + +![](../images/dotline.png) + +## Random Shape + +`random shape` would draw images with random shapes. The whole image would rotate with some degree. + +### parameters + +- shapeNum: It indicates how many shapes you want to draw. + +```go +rs := NewRandomShape(150) +``` + +![](../images/randomshape.png) + +## Janus + +`Janus` would draws a image with multiple circles split at its center with random noise in the horizontal direction. + +### TODO + +### parameters + +## Silk Sky + +`Silk Sky` would draws a image with multiple circles converge to one point or circle. + +### parameters + +- circleNum: The number of the circles in this drawing. +- sunRadius: The radius of the sun. The sun is a point/circle where other circles meet. + +```go +silkSky := NewSilkSky(circleNum int, sunRadius float64) +``` + +![](../images/silksky.png) + +## Julia + +`Julia` is to draw a `Julia Set`. [Julia Set](https://en.wikipedia.org/wiki/Julia_set) is a math concept. You can define your own formula in this package. + +### parameters + +- fn: The custom julia set function. +- maxz: The maximum modulus length of a complex number. +- xaixs, yaixs: The range for the X-Y coordination used to mapping the julia set number to the real pixel of the image. These should be positive number. It only indicates the first quadrant range. + +```go +func julia1(z complex128) complex128 { + c := complex(-0.1, 0.651) + z = z*z + c + return z +} +julia := generativeart.NewJulia(julia1, 40, 1.5, 1.5) +``` + +![](../images/julia.png) \ No newline at end of file