anim

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 13 Imported by: 0

README

anim

Package anim contains a range of terminal animations. These are used on cy's splash screen and in the background while fuzzy finding.

Documentation

Index

Constants

View Source
const DEFAULT_FPS = 30
View Source
const (
	POSITION_FACTOR = 10
)
View Source
const (
	TICKS_PER_SECOND = 10
)

Variables

View Source
var Animations = map[string]Creator{}
View Source
var BRAILLE = func() (runes []rune) {
	bytes := []byte{226, 161, 0}
	for i := byte(128); i < 192; i++ {
		bytes[2] = i
		r, _ := utf8.DecodeRune(bytes)
		runes = append(runes, r)
	}
	return
}()

Functions

func NewAnimator

func NewAnimator(
	ctx context.Context,
	animation Animation,
	initial image.Image,
	fps int,
	options ...Option,
) *taro.Program

Types

type Animation

type Animation interface {
	Init(image.Image)
	Update(delta time.Duration) image.Image
}

type Animator

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

func (*Animator) Init added in v0.1.6

func (a *Animator) Init() tea.Cmd

func (*Animator) Update added in v0.1.6

func (a *Animator) Update(msg tea.Msg) (taro.Model, tea.Cmd)

func (*Animator) View added in v0.1.6

func (a *Animator) View(state *tty.State)

type Collapse added in v0.1.5

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

func (*Collapse) Init added in v0.1.5

func (c *Collapse) Init(start image.Image)

func (*Collapse) Update added in v0.1.5

func (c *Collapse) Update(delta time.Duration) image.Image

type Conway

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

func (*Conway) Init

func (c *Conway) Init(start image.Image)

func (*Conway) Update

func (c *Conway) Update(delta time.Duration) image.Image

type Cos added in v0.1.13

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

func (*Cos) Init added in v0.1.13

func (cos *Cos) Init(start image.Image)

func (*Cos) Update added in v0.1.13

func (cos *Cos) Update(delta time.Duration) image.Image

type Creator added in v0.1.6

type Creator func() Animation

type Cyform

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

func (*Cyform) Init

func (c *Cyform) Init(start image.Image)

func (*Cyform) Update

func (c *Cyform) Update(delta time.Duration) image.Image

type Fluid added in v0.1.18

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

func (*Fluid) Init added in v0.1.18

func (f *Fluid) Init(start image.Image)

func (*Fluid) Update added in v0.1.18

func (f *Fluid) Update(delta time.Duration) image.Image

type Midjo

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

func (*Midjo) Init

func (m *Midjo) Init(start image.Image)

func (*Midjo) Update

func (mid *Midjo) Update(delta time.Duration) image.Image

type Option added in v0.1.6

type Option func(*Animator)

func WithStartTime added in v0.1.6

func WithStartTime(start time.Time) Option

type Static added in v0.4.0

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

func (*Static) Init added in v0.4.0

func (s *Static) Init(start image.Image)

func (*Static) Update added in v0.4.0

func (s *Static) Update(delta time.Duration) image.Image

Jump to

Keyboard shortcuts

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