Changeset - 6fefdc0c2c69
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 8 years ago 2017-06-11 02:56:34
drewp@bigasterisk.com
more rgb_to_hex fixes
Ignore-this: fe3710525964a1a74a8b38267e8ed668
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
light9/effect/effecteval.py
Show inline comments
 
@@ -12,13 +12,13 @@ import time
 
from light9.effect.settings import DeviceSettings
 

	
 

	
 
log = logging.getLogger('effecteval')
 

	
 
def literalColor(rnorm, gnorm, bnorm):
 
    return Literal(rgb_to_hex([rnorm * 255, gnorm * 255, bnorm * 255]))
 
    return Literal(rgb_to_hex([int(rnorm * 255), int(gnorm * 255), int(bnorm * 255)]))
 

	
 
def literalColorHsv(h, s, v):
 
    return literalColor(*hsv_to_rgb(h, s, v))
 
    
 
def nsin(x): return (math.sin(x * (2 * math.pi)) + 1) / 2
 
def ncos(x): return (math.cos(x * (2 * math.pi)) + 1) / 2
 
@@ -293,13 +293,13 @@ def effect_orangeSearch(effectSettings, 
 
def effect_Strobe(effectSettings, strength, songTime, noteTime):
 
    rate = 2
 
    duty = .3
 
    offset = 0
 
    f = (((songTime + offset) * rate) % 1.0)
 
    c = (f < duty) * strength
 
    col = rgb_to_hex([c * 255, c * 255, c * 255])
 
    col = rgb_to_hex([int(c * 255), int(c * 255), int(c * 255)])
 
    return {(L9['device/colorStrip'], L9['color']): Literal(col)}
 

	
 
def effect_lightning(effectSettings, strength, songTime, noteTime):
 
    devs = [L9['device/veryLow1'], L9['device/veryLow2'],
 
            L9['device/veryLow3'], L9['device/veryLow4'],
 
            L9['device/veryLow5'], L9['device/backlight1'],
 
@@ -307,12 +307,12 @@ def effect_lightning(effectSettings, str
 
            L9['device/backlight4'], L9['device/backlight5'],
 
            L9['device/down2'], L9['device/down3'],
 
            L9['device/down4'], L9['device/hexLow3'],
 
            L9['device/hexLow5'], L9['device/lip1 5'],
 
            L9['device/postL1'], L9['device/postR1']]
 
    out = {}
 
    col = rgb_to_hex([255 * strength] * 3)
 
    col = rgb_to_hex([int(255 * strength)] * 3)
 
    for i, dev in enumerate(devs):
 
        n = noise(songTime * 8 + i * 6.543)
 
        if n > .4:
 
            out[(dev, L9['color'])] = col
 
    return out
0 comments (0 inline, 0 general)