asciibrot

package module
v0.0.0-...-2fef8df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 11 Imported by: 0

README

Description

asciibrot is a simple ascii mandelbrot fractal generator running in terminal. It's written in Go and should run on all the existing platforms, however the Linux based is the one on which it was tested.

Install

go get github.com/esimov/asciibrot

Usage

go run julia.go --help

You can run the example in monochrome or color version. For the color version use --color or -c. For monochrome version use --mono or -m.

You can build the binary version with go build github.com/esimov/asciibrot.

Code example

To generate different output you can play with values defined in the main function:

for {
    n += 0.045
    zoom += 0.04 * math.Sin(n)
    asciibrot.DrawFractal(zoom, math.Cos(n), math.Sin(n)/zoom*0.02, math.Sin(n), MAX_IT, true, isColor)

    // On CTRL+C restore default terminal foreground and background color
    go func() {
        <-c
        fmt.Fprint(asciibrot.Screen, "%s%s", "\x1b[49m", "\x1b[39m")
        fmt.Fprint(asciibrot.Screen, "\033[2J")
        asciibrot.Flush()
        os.Exit(1)
    }()
}

Blog post on my personal website: http://esimov.com/2016/05/ascii-mandelbrot-renderer-in-go

Sample

asciibrot-gif

License

This project is under MIT License.

Documentation

Index

Constants

This section is empty.

Variables

Screen buffer Do not write to buffer directly, use package Print, Printf, Println functions instead.

Functions

func DrawFractal

func DrawFractal(zoom, moveX, moveY float64, z float64, max_it int, isColor bool)

func Flush

func Flush()

Flush buffer and ensure that it will not overflow screen

func Height

func Height() int

Get console height

func MoveCursor

func MoveCursor(x int, y int)

Move cursor to given position

func Width

func Width() int

Get console width

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL