func BrightnessScalingEffectFactory(l devices.DimLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { c, ok := config.(*BrightnessConfig) if !ok { return errors.New("Not a BrightnessConfig") } return l.BrightnessScaling(c.Brightness) }) }
func ColorEffectFactory(l devices.ColorLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { conf, ok := config.(*ColorConfig) if !ok { return errors.New("Not a ColorConfig") } m := color.RGBAModel return l.Color(m.Convert(conf.Color).(color.RGBA)) }) }
func ClockEffectFactory(l devices.WordClock) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { _, ok := config.(*deviceapi.EmptyConfig) if !ok { return errors.New("Not an empty Config") } return l.Clock() }) }
func HeartEffectFactory(l devices.MatrixLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { _, ok := config.(*deviceapi.EmptyConfig) if !ok { return errors.New("Not an empty Config") } return l.Heart() }) }
func NewWhiteFadeEffect(l devices.DimLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { strobeConf, ok := config.(*deviceapi.DelayConfig) if !ok { return errors.New("Not a WhiteFadeConfig") } delay, err := time.ParseDuration(strobeConf.Delay) if err != nil { return err } return l.Fade(delay, 255) }) }
func StrobeEffectFactory(l devices.DimLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { strobeConf, ok := config.(*deviceapi.DelayConfig) if !ok { return errors.New("Not a StrobeConfig") } delay, err := time.ParseDuration(strobeConf.Delay) if err != nil { return err } return l.Stroboscope(delay) }) }
func SunriseEffectFactory(l devices.ColorLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { sunriseConf, ok := config.(*deviceapi.DelayConfig) if !ok { return errors.New("Not a SunriseConfig") } delay, err := time.ParseDuration(sunriseConf.Delay) if err != nil { return err } return l.Sunrise(delay) }) }
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) }) }
func ColorFadeEffect(l devices.ColorLamp) deviceapi.Effect { return deviceapi.EffectFunc(func(config deviceapi.Config) error { colorfadeConf, ok := config.(*ColorfadeConfig) if !ok { return errors.New("Not a ColorFadeConfig") } delay, err := time.ParseDuration(colorfadeConf.Delay) if err != nil { return err } m := color.RGBAModel return l.ColorFade(delay, m.Convert(colorfadeConf.Color).(color.RGBA)) }) }