ascii-live/frames/frames.go

48 lines
1.1 KiB
Go
Raw Normal View History

2019-11-19 05:51:48 +00:00
package frames
type FrameType struct {
GetFrame func(int) string
GetLength func() int
}
// Create a function that returns the next frame, based on length
func DefaultGetFrame(frames []string) func(int) string {
return func(i int) string {
return frames[i%(len(frames))]
2019-11-19 05:51:48 +00:00
}
}
// Create a function that returns frame length
func DefaultGetLength(frames []string) func() int {
return func() int {
return len(frames)
}
}
// Given frames, create a FrameType with those frames
func DefaultFrameType(frames []string) FrameType {
return FrameType{
GetFrame: DefaultGetFrame(frames),
GetLength: DefaultGetLength(frames),
}
}
var FrameMap = map[string]FrameType{
"forrest": Forrest,
"parrot": Parrot,
"clock": Clock,
"nyan": Nyan,
"rick": Rick,
"can-you-hear-me": Rick,
2023-02-10 09:20:54 +00:00
"donut": Donut,
"batman": Batman,
2023-04-20 08:58:57 +00:00
"coin": Coin,
2023-06-14 20:06:53 +00:00
"torus-knot": TorusKnot,
"knot": TorusKnot,
"spidyswing": Spidy,
"batman-running": BNR,
"bnr": BNR,
2023-10-08 06:01:58 +00:00
"playstation": PlayStation,
2023-10-01 10:04:11 +00:00
"hes": HES,
2019-11-19 05:51:48 +00:00
}