Documentation
¶
Overview ¶
Package animations provides terminal animation effects for Go applications.
sysc-Go includes multiple animation effects with customizable color themes:
- Fire: DOOM PSX-style fire effect
- Matrix: Digital rain with falling character streaks
- Fireworks: Physics-based particle fireworks
- Rain: ASCII character rain effect
Basic usage:
palette := animations.GetFirePalette("dracula")
fire := animations.NewFireEffect(80, 24, palette)
for frame := 0; frame < 200; frame++ {
fire.Update(frame)
output := fire.Render()
fmt.Print(output)
}
See GUIDE.md for detailed usage examples and integration patterns.
Index ¶
- func GetDefaultFirePalette() []string
- func GetFirePalette(themeName string) []string
- func GetFireworksPalette(themeName string) []string
- func GetMatrixPalette(themeName string) []string
- func GetParticlePalette(themeName string) []string
- func GetRainPalette(themeName string) []string
- func GetScreensaverPalette(themeName string) []string
- type Animation
- type Config
- type Drop
- type FireEffect
- type FireworksEffect
- type MatrixChar
- type MatrixEffect
- type MatrixStreak
- type Particle
- type RainEffect
- type RoastingTicker
- type TickerAnimation
- type TypewriterTicker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultFirePalette ¶
func GetDefaultFirePalette() []string
GetDefaultFirePalette returns classic DOOM-style fire palette
func GetFirePalette ¶
GetFirePalette returns theme-specific fire colors
func GetFireworksPalette ¶
GetFireworksPalette returns theme-specific fireworks colors
func GetMatrixPalette ¶
GetMatrixPalette returns theme-specific matrix rain colors
func GetParticlePalette ¶
GetParticlePalette returns theme-specific particle colors
func GetRainPalette ¶
GetRainPalette returns theme-specific rain colors
func GetScreensaverPalette ¶
CHANGED 2025-10-10 - Screensaver palette for theme-aware colors GetScreensaverPalette returns theme-specific colors for screensaver elements Returns: [background, ascii_primary, ascii_secondary, clock_primary, clock_secondary, date_color]
Types ¶
type Animation ¶
type Animation interface {
// Update advances the animation by one frame
Update()
// Render returns the current frame as a string
Render() string
// Reset restarts the animation from the beginning
Reset()
}
Animation interface that all effects implement
type Config ¶
type Config struct {
Width int // Terminal width in characters
Height int // Terminal height in characters
Theme string // Color theme name
}
Config holds common animation settings
type Drop ¶
type Drop struct {
X int // X position
Y int // Y position
Speed int // Fall speed
Char rune // Character to display
Color string // Color hex code
}
Drop represents a single raindrop
type FireEffect ¶
type FireEffect struct {
// contains filtered or unexported fields
}
FireEffect implements PSX DOOM-style fire algorithm
func NewFireEffect ¶
func NewFireEffect(width, height int, palette []string) *FireEffect
NewFireEffect creates a new fire effect with given dimensions and theme palette
func (*FireEffect) Render ¶
func (f *FireEffect) Render() string
Render converts the fire buffer to colored text output
func (*FireEffect) Resize ¶
func (f *FireEffect) Resize(width, height int)
Resize reinitializes the fire effect with new dimensions
func (*FireEffect) Update ¶
func (f *FireEffect) Update(frame int)
Update advances the fire simulation by one frame
func (*FireEffect) UpdatePalette ¶
func (f *FireEffect) UpdatePalette(palette []string)
UpdatePalette changes the fire color palette (for theme switching)
type FireworksEffect ¶
type FireworksEffect struct {
// contains filtered or unexported fields
}
FireworksEffect implements fireworks animation
func NewFireworksEffect ¶
func NewFireworksEffect(width, height int, palette []string) *FireworksEffect
NewFireworksEffect creates a new fireworks effect
func (*FireworksEffect) Render ¶
func (fw *FireworksEffect) Render() string
Render converts the fireworks to colored text output
func (*FireworksEffect) Resize ¶
func (fw *FireworksEffect) Resize(width, height int)
Resize reinitializes the fireworks effect with new dimensions
func (*FireworksEffect) Update ¶
func (fw *FireworksEffect) Update(frame int)
Update advances the fireworks simulation
func (*FireworksEffect) UpdatePalette ¶
func (fw *FireworksEffect) UpdatePalette(palette []string)
UpdatePalette changes the fireworks color palette
type MatrixChar ¶
MatrixChar represents a single character in a streak
type MatrixEffect ¶
type MatrixEffect struct {
// contains filtered or unexported fields
}
MatrixEffect implements Matrix digital rain animation using particle-based streaks
func NewMatrixEffect ¶
func NewMatrixEffect(width, height int, palette []string) *MatrixEffect
NewMatrixEffect creates a new Matrix effect with given dimensions and theme palette
func (*MatrixEffect) Render ¶
func (m *MatrixEffect) Render() string
Render converts the Matrix streaks to colored text output
func (*MatrixEffect) Resize ¶
func (m *MatrixEffect) Resize(width, height int)
Resize reinitializes the Matrix effect with new dimensions
func (*MatrixEffect) Update ¶
func (m *MatrixEffect) Update(frame int)
Update advances the Matrix simulation by one frame
func (*MatrixEffect) UpdatePalette ¶
func (m *MatrixEffect) UpdatePalette(palette []string)
UpdatePalette changes the Matrix color palette (for theme switching)
type MatrixStreak ¶
type MatrixStreak struct {
X int // X position (column)
Y int // Y position of head
Length int // Length of streak
Speed int // Movement speed (frames per pixel)
Counter int // Frame counter for movement
Active bool // Whether streak is active
}
MatrixStreak represents a single vertical streak falling down the screen
type Particle ¶
type Particle struct {
// contains filtered or unexported fields
}
Particle represents a single firework particle
type RainEffect ¶
type RainEffect struct {
// contains filtered or unexported fields
}
RainEffect implements ascii rain animation
func NewRainEffect ¶
func NewRainEffect(width, height int, palette []string) *RainEffect
NewRainEffect creates a new rain effect with given dimensions and theme palette
func (*RainEffect) Render ¶
func (r *RainEffect) Render() string
Render converts the rain drops to colored text output
func (*RainEffect) Resize ¶
func (r *RainEffect) Resize(width, height int)
Resize reinitializes the rain effect with new dimensions
func (*RainEffect) Update ¶
func (r *RainEffect) Update(frame int)
Update advances the rain simulation by one frame
func (*RainEffect) UpdatePalette ¶
func (r *RainEffect) UpdatePalette(palette []string)
UpdatePalette changes the rain color palette (for theme switching)
type RoastingTicker ¶
type RoastingTicker struct {
// contains filtered or unexported fields
}
RoastingTicker provides scrolling text with WM-specific roasts
func NewRoastingTicker ¶
func NewRoastingTicker(wmName string) *RoastingTicker
NewRoastingTicker creates a scrolling roast ticker
func (*RoastingTicker) GetScrollingText ¶
func (r *RoastingTicker) GetScrollingText(width int) string
GetScrollingText returns the scrolling text for given width Cycle through individual roast phrases
func (*RoastingTicker) UpdateWM ¶
func (r *RoastingTicker) UpdateWM(wmName string)
UpdateWM changes the roast text when WM selection changes
type TickerAnimation ¶
type TickerAnimation struct {
// contains filtered or unexported fields
}
TickerAnimation provides animated loading/thinking effect
func NewTickerAnimation ¶
func NewTickerAnimation() *TickerAnimation
NewTickerAnimation creates a new ticker animation
func (*TickerAnimation) GetFrame ¶
func (t *TickerAnimation) GetFrame() string
GetFrame returns the current animation frame Returns a string like "⠋", "⠙", "⠹", etc. (braille spinner)
func (*TickerAnimation) GetTitle ¶
func (t *TickerAnimation) GetTitle(width int) string
GetTitle returns the animated title replacing "SESSIONS"
type TypewriterTicker ¶
type TypewriterTicker struct {
// contains filtered or unexported fields
}
TypewriterTicker types out text one character at a time with a block cursor This provides a "typewriter" effect for the roast messages
func NewTypewriterTicker ¶
func NewTypewriterTicker(wmName string) *TypewriterTicker
NewTypewriterTicker creates a new typewriter ticker
func (*TypewriterTicker) GetTypewriterText ¶
func (t *TypewriterTicker) GetTypewriterText(width int) string
GetTypewriterText returns the current typewriter text with block cursor
func (*TypewriterTicker) UpdateWM ¶
func (t *TypewriterTicker) UpdateWM(wmName string)
UpdateWM changes the roast text when WM selection changes