func NewRandomColorEffect(l devices.StripeLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { sunriseConf, ok := config.(*deviceapi.DelayConfig) if !ok { return errors.New("Not a WheelConfig") } delay, err := time.ParseDuration(sunriseConf.Delay) if err != nil { return err } return l.RandomPixelColor(delay) }) }
func RainbowEffectFactory(l devices.StripeLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { rainbowConf, ok := config.(*deviceapi.DelayConfig) if !ok { return errors.New("Not a RainbowConfig") } delay, err := time.ParseDuration(rainbowConf.Delay) if err != nil { return err } return l.Rainbow(delay) }) }