mirror of
https://github.com/maaslalani/confetty.git
synced 2024-12-22 06:06:39 +00:00
export spawn
This commit is contained in:
parent
70c180fb36
commit
fe126ff4df
@ -36,7 +36,7 @@ type model struct {
|
||||
system *simulation.System
|
||||
}
|
||||
|
||||
func spawn(width, height int) []simulation.Particle {
|
||||
func Spawn(width, height int) []simulation.Particle {
|
||||
particles := []simulation.Particle{}
|
||||
for i := 0; i < numParticles; i++ {
|
||||
x := float64(width / 2)
|
||||
@ -66,7 +66,7 @@ func InitialModel() model {
|
||||
}
|
||||
|
||||
return model{system: &simulation.System{
|
||||
Particles: spawn(width, height),
|
||||
Particles: Spawn(width, height),
|
||||
Frame: simulation.Frame{
|
||||
Width: width,
|
||||
Height: height,
|
||||
@ -88,7 +88,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case "ctrl+c", "q":
|
||||
return m, tea.Quit
|
||||
}
|
||||
m.system.Particles = spawn(m.system.Frame.Width, m.system.Frame.Height)
|
||||
m.system.Particles = Spawn(m.system.Frame.Width, m.system.Frame.Height)
|
||||
return m, nil
|
||||
case frameMsg:
|
||||
m.system.Update()
|
||||
|
@ -37,7 +37,7 @@ type model struct {
|
||||
system *simulation.System
|
||||
}
|
||||
|
||||
func spawn(width, height int) []simulation.Particle {
|
||||
func Spawn(width, height int) []simulation.Particle {
|
||||
color := lipgloss.Color(array.Sample(colors))
|
||||
v := float64(rand.Intn(10) + 20.0)
|
||||
|
||||
@ -68,7 +68,7 @@ func InitialModel() model {
|
||||
}
|
||||
|
||||
return model{system: &simulation.System{
|
||||
Particles: spawn(width, height),
|
||||
Particles: Spawn(width, height),
|
||||
Frame: simulation.Frame{
|
||||
Width: width,
|
||||
Height: height,
|
||||
@ -90,7 +90,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case "ctrl+c", "q":
|
||||
return m, tea.Quit
|
||||
}
|
||||
m.system.Particles = spawn(m.system.Frame.Width, m.system.Frame.Height)
|
||||
m.system.Particles = Spawn(m.system.Frame.Width, m.system.Frame.Height)
|
||||
return m, nil
|
||||
case frameMsg:
|
||||
m.system.Update()
|
||||
|
Loading…
Reference in New Issue
Block a user