mirror of
https://github.com/maaslalani/confetty.git
synced 2024-11-28 10:36:38 +00:00
trigger on keypress
This commit is contained in:
parent
45abcd2122
commit
70c180fb36
@ -86,7 +86,12 @@ func (m model) Init() tea.Cmd {
|
|||||||
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
switch msg := msg.(type) {
|
switch msg := msg.(type) {
|
||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
return m, tea.Quit
|
switch msg.String() {
|
||||||
|
case "ctrl+c", "q":
|
||||||
|
return m, tea.Quit
|
||||||
|
}
|
||||||
|
m.system.Particles = spawn(m.system.Frame.Width, m.system.Frame.Height)
|
||||||
|
return m, nil
|
||||||
case frameMsg:
|
case frameMsg:
|
||||||
m.system.Update()
|
m.system.Update()
|
||||||
return m, animate()
|
return m, animate()
|
||||||
|
Loading…
Reference in New Issue
Block a user