Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Glyph ¶
type Glyph struct {
// contains filtered or unexported fields
}
Glyph represents a glyph in the simulation. The X axis uses a spring follower for a drifting, slightly-lagged feel. The Y axis uses direct Euler integration so gravity and floor bounces are lag-free and land exactly on the floor row.
type PhysicsConfig ¶
type PhysicsConfig struct {
Gravity float64 // cells/frame² downward acceleration
Restitution float64 // fraction of speed retained on floor bounce
XFloorFriction float64 // fraction of target x velocity retained on floor bounce
EnableCollision bool // enables glyph-glyph collisions (extra CPU work)
EnableDespawn bool // enables resting glyph despawn after timeout
RestThreshold float64 // cells/frame speed below which a glyph is considered at rest
RestTimeoutSeconds float64 // seconds at rest before despawn
SpringFrequency float64 // spring angular frequency for x-axis follow behavior
SpringDampingRatio float64 // spring damping ratio for x-axis follow behavior
LaunchKickMax float64 // max upward launch speed magnitude for initial glyphs
SpawnKickMax float64 // max upward launch speed magnitude for spawned glyphs
TargetDriftMax float64 // max absolute x target drift speed
}
PhysicsConfig controls spring tuning and y-axis bounce behavior.
func DefaultPhysicsConfig ¶
func DefaultPhysicsConfig() PhysicsConfig
DefaultPhysicsConfig returns the baseline motion tuning.
type Simulation ¶
type Simulation struct {
// contains filtered or unexported fields
}
Simulation manages the bouncing glyphs.
func New ¶
func New(count, fps int) *Simulation
New creates a new Simulation. Width and height are determined from the terminal on the first WindowSizeMsg.
func NewWithPhysicsConfig ¶
func NewWithPhysicsConfig(count, fps int, physics PhysicsConfig) *Simulation
NewWithPhysicsConfig creates a new Simulation using caller-provided physics tuning.
func (*Simulation) EnableStream ¶
func (sim *Simulation) EnableStream(reader io.Reader, spawnInterval, dropDelay time.Duration)
EnableStream configures the simulation to read glyphs from a stream and spawn them at a fixed interval.
func (*Simulation) Init ¶
func (sim *Simulation) Init() tea.Cmd
Init requests the first animation frame.
func (*Simulation) View ¶
func (sim *Simulation) View() string