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)-1)]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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{
|
2022-11-01 00:04:13 +00:00
|
|
|
"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,
|
2023-03-22 14:09:07 +00:00
|
|
|
"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,
|
2023-06-19 01:05:20 +00:00
|
|
|
"spidyswing": Spidy,
|
|
|
|
"batman-running": BNR,
|
|
|
|
"bnr": BNR,
|
2019-11-19 05:51:48 +00:00
|
|
|
}
|