blob: f185b405f6551cdc3be046eff193050803726e70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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,[])
|