diff --git a/fireworks/fireworks.go b/fireworks/fireworks.go index c529b94..4c614ec 100644 --- a/fireworks/fireworks.go +++ b/fireworks/fireworks.go @@ -20,12 +20,12 @@ import ( const ( framesPerSecond = 60.0 - numParticles = 75 + numParticles = 50 ) var ( colors = []string{"#fdff6a", "#ff718d"} - characters = []string{"•"} + characters = []string{"+", "*", "•"} // characters = []string{"▄", "▀"} ) @@ -53,7 +53,6 @@ type model struct { type Particle struct { char string physics *physics.Physics - radius float64 } func spawn() []*Particle { @@ -64,7 +63,6 @@ func spawn() []*Particle { color := lipgloss.Color(array.Sample(colors)) v := float64(rand.Intn(10) + 20.0) - r := float64(rand.Intn(5) + 10) particles := []*Particle{} @@ -76,13 +74,12 @@ func spawn() []*Particle { physics: physics.New( physics.Point{X: x, Y: y}, physics.Vector{X: math.Cos(float64(i)) * v, Y: math.Sin(float64(i)) * v / 2}, - physics.Vector{Y: 2}, + physics.Vector(physics.Gravity), framesPerSecond, ), char: lipgloss.NewStyle(). Foreground(color). Render(array.Sample(characters)), - radius: r, } particles = append(particles, p) @@ -120,14 +117,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { particlesVisible -= 1 continue } - - // Particle has reached its distance from the radius. - // In the fireworks simulation, firework particles fade after reaching a certain point - // just like in real life, so we don't render them if they've passed a certain distance - if p.physics.Displacement() > p.radius { - particlesVisible -= 1 - continue - } } if particlesVisible <= 0 {