diff options
Diffstat (limited to 'behaviors/ColorShift.py')
-rw-r--r-- | behaviors/ColorShift.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/behaviors/ColorShift.py b/behaviors/ColorShift.py new file mode 100644 index 0000000..f185b40 --- /dev/null +++ b/behaviors/ColorShift.py @@ -0,0 +1,16 @@ +import util.ColorOps as colorOps +from operationscore.Behavior import * +import colorsys +class ColorShift(Behavior): + def processResponse(self, sensor, recurs): + ret = [] + for data in sensor: + if not 'HSV' in data: + data['HSV'] = list(colorsys.rgb_to_hsv(*data['Color'])) + + data['HSV'][0] += .01 + if data['HSV'][0] >= 360: + data['HSV'][0] = 0 + data['Color'] = colorsys.hsv_to_rgb(*data['HSV']) + ret.append(data) + return (ret,[]) |