Mercurial > code > home > repos > light9
changeset 1198:c98a239e0d0b
new effects
Ignore-this: b5273b607b63fa8a423c2c2a223dbed5
author | drewp@bigasterisk.com |
---|---|
date | Sun, 15 Jun 2014 22:56:34 +0000 |
parents | d91aecab1418 |
children | 30793e93e4eb |
files | light9/Effects.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/Effects.py Sun Jun 15 22:52:40 2014 +0000 +++ b/light9/Effects.py Sun Jun 15 22:56:34 2014 +0000 @@ -21,7 +21,10 @@ which = 'L' # LR means both pixels = [] @classmethod - def solid(cls, which='L', color=(1,1,1)): + def solid(cls, which='L', color=(1,1,1), hsv=None): + """hsv overrides color""" + if hsv is not None: + color = colorsys.hsv_to_rgb(hsv[0] % 1.0, hsv[1], hsv[2]) x = cls() x.which = which x.pixels = [tuple(color)] * 50 @@ -123,6 +126,9 @@ ret['nsin'] = lambda x: (math.sin(x * (2 * math.pi)) + 1) / 2 ret['ncos'] = lambda x: (math.cos(x * (2 * math.pi)) + 1) / 2 + def nsquare(t, on=.5): + return (t % 1.0) < on + ret['nsquare'] = nsquare _smooth_random_items = [random_mod.random() for x in range(100)]