package effects import ( "fmt" "git.aiterp.net/lucifer3/server/device" "time" ) type Pattern struct { States []device.State `json:"states,omitempty"` ShiftMS int64 `json:"shiftMs,omitempty"` } func (p Pattern) State(index, round, _ int) device.State { return p.States[(index+round)%len(p.States)] } func (p Pattern) Frequency() time.Duration { return time.Duration(p.ShiftMS) * time.Millisecond } func (p Pattern) EffectDescription() string { return fmt.Sprintf("Pattern(len:%d, animation:%dms)", len(p.States), p.ShiftMS) }