lightning

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cone

type Cone struct {
	Left  float64
	Right float64
}

Cone is a struct that represents cone-like area with left and right bounds defined by angle from root point of the tree. Main branch of the tree should grow inside the cone. Lateral branches could grow outside it.

type LightningGenerator

type LightningGenerator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(x int, v *viper.Viper) (*LightningGenerator, error)

func (*LightningGenerator) Generate

func (g *LightningGenerator) Generate() *Node

type Node

type Node struct {
	// Coordinates of the node
	Point Point

	Children []*Node

	// IsMain holds true if node is a part of main branch and false if
	// lateral branch
	IsMain bool

	// Generation is a number of generation of the node on a lateral branch
	// only. For main branch it is always 0
	Generation int

	// GrowthAngle defines direction which the node growed in
	GrowthAngle float64
}

Node is a struct that represents tree node

type Painter

type Painter struct {
	// contains filtered or unexported fields
}

func NewPainter

func NewPainter(root *Node, v *viper.Viper) *Painter

func (*Painter) Paint

func (p *Painter) Paint(filename string) error

Paints generated lightning and saves it into a file. If filename is an empty string it paints it onto the screen as wallpepers using feh

type Point

type Point struct {
	X, Y int
}

type RGBColor

type RGBColor struct {
	R, G, B float64
}

func NewRGBColor

func NewRGBColor(hex string) (*RGBColor, error)

func (RGBColor) Core

func (c RGBColor) Core(factor float64) RGBColor

Core shifts the color toward pure white (1.0, 1.0, 1.0) by an intensity factor. factor = 0.0 returns the original color; factor = 1.0 returns pure white.

Jump to

Keyboard shortcuts

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