animation

package
v1.19.7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package animation provides centralized animation tick management for the TUI. All animated components (spinners, fades, etc.) share a single tick stream to avoid tick storms and ensure synchronized animations.

Thread safety: All exported functions are safe for concurrent use, though the typical usage pattern is single-threaded via Bubble Tea's Update loop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasActive

func HasActive() bool

HasActive returns true if any animations are currently active.

func Register

func Register()

Register increments the active animation count. Call this when an animation starts.

func StartTick

func StartTick() tea.Cmd

StartTick starts the global animation tick if any animations are active. Call this after processing a TickMsg to continue the tick stream.

func StartTickIfFirst

func StartTickIfFirst() tea.Cmd

StartTickIfFirst registers an animation and starts the tick if this is the first. This is atomic: no race between checking and registering. Returns the tick command if the tick stream was started, nil otherwise.

func Unregister

func Unregister()

Unregister decrements the active animation count. Call this when an animation stops.

Types

type Coordinator

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

Coordinator manages a single tick stream for all animations. It tracks active animations and only generates ticks when at least one is active.

type TickMsg

type TickMsg struct {
	Frame int
}

TickMsg is broadcast to all animated components on each animation frame. Components should handle this message to update their animation state.

Jump to

Keyboard shortcuts

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