bubbletea

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnimatedCharacter

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

AnimatedCharacter is a Bubble Tea component that provides ready-to-use character animation with state management.

This eliminates the need for custom adapters and provides plug-and-play character animation for Bubble Tea applications.

Example:

agent, _ := characters.LibraryAgent("sam")
char := bubbletea.NewAnimatedCharacter(agent, 500*time.Millisecond)
char.SetState("plan")

// Use in Bubble Tea program:
program := tea.NewProgram(char)
program.Run()

func NewAnimatedCharacter

func NewAnimatedCharacter(agent *characters.AgentCharacter, tickInterval time.Duration) *AnimatedCharacter

NewAnimatedCharacter creates a new Bubble Tea component from an AgentCharacter. The tickInterval determines the animation speed (e.g., 500ms = 2 FPS).

Example:

agent, _ := characters.LibraryAgent("sam")
char := bubbletea.NewAnimatedCharacter(agent, 500*time.Millisecond)

func (*AnimatedCharacter) GetHeight

func (m *AnimatedCharacter) GetHeight() int

GetHeight returns the character height

func (*AnimatedCharacter) GetState

func (m *AnimatedCharacter) GetState() string

GetState returns the current state name

func (*AnimatedCharacter) GetTickInterval

func (m *AnimatedCharacter) GetTickInterval() time.Duration

GetTickInterval returns the current tick interval

func (*AnimatedCharacter) GetWidth

func (m *AnimatedCharacter) GetWidth() int

GetWidth returns the character width

func (*AnimatedCharacter) Init

func (m *AnimatedCharacter) Init() tea.Cmd

Init implements tea.Model

func (*AnimatedCharacter) IsPlaying

func (m *AnimatedCharacter) IsPlaying() bool

IsPlaying returns whether animation is currently playing

func (*AnimatedCharacter) ListStates

func (m *AnimatedCharacter) ListStates() []string

ListStates returns all available state names

func (*AnimatedCharacter) Pause

func (m *AnimatedCharacter) Pause()

Pause pauses animation

func (*AnimatedCharacter) Play

func (m *AnimatedCharacter) Play()

Play starts or resumes animation

func (*AnimatedCharacter) Reset

func (m *AnimatedCharacter) Reset()

Reset resets animation to first frame

func (*AnimatedCharacter) SetState

func (m *AnimatedCharacter) SetState(stateName string) error

SetState changes the current animation state Returns error if state doesn't exist

func (*AnimatedCharacter) SetTickInterval

func (m *AnimatedCharacter) SetTickInterval(interval time.Duration)

SetTickInterval changes the animation speed

func (*AnimatedCharacter) Update

func (m *AnimatedCharacter) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model

func (*AnimatedCharacter) View

func (m *AnimatedCharacter) View() string

View implements tea.Model

type TickMsg

type TickMsg time.Time

TickMsg is sent on each animation tick

Jump to

Keyboard shortcuts

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