Changeset - 0dd0b5e282b4
[Not reviewed]
default
0 3 0
drewp@bigasterisk.com - 7 years ago 2018-06-09 22:40:39
drewp@bigasterisk.com
qsweepusa effects
Ignore-this: 651c0975777e428f35047a68083aad94
3 files changed with 29 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/effect/effecteval.py
Show inline comments
 
@@ -3,24 +3,26 @@ from rdflib import URIRef, Literal
 
from light9.namespaces import L9, RDF, DEV
 
from webcolors import rgb_to_hex, hex_to_rgb
 
from colorsys import hsv_to_rgb
 
from decimal import Decimal
 
import math
 
import traceback
 
from noise import pnoise1
 
import logging
 
import time
 
from light9.effect.settings import DeviceSettings
 
from light9.effect.scale import scale
 
import random
 
random.seed(0)
 
print "reload effecteval"
 

	
 
log = logging.getLogger('effecteval')
 

	
 
def literalColor(rnorm, gnorm, bnorm):
 
    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
 
def nsquare(t, on=.5):
 
@@ -189,24 +191,47 @@ def effect_qsweep(effectSettings, streng
 
        dev = L9['device/q%s' % n]
 
        out.update({
 
            (dev, L9['color']): col,
 
            (dev, L9['zoom']): effectSettings.get(L9['zoom'], .5),
 
            })
 
        out.update({
 
            (dev, L9['rx']):
 
            lerp(.3, .8, nsin(songTime / period + n / 4)),
 
        (dev, L9['ry']): effectSettings.get(L9['ry'], .2),
 
            })
 
    return out
 

	
 
def effect_qsweepusa(effectSettings, strength, songTime, noteTime):
 
    out = {}
 
    period = float(effectSettings.get(L9['period'], 2))
 

	
 
    colmap = {
 
        1: '#ff0000',
 
        2: '#888888',
 
        3: '#5050ff',
 
    }
 
    
 
    for n in range(1, 3+1):
 
        dev = L9['device/q%s' % n]
 
        out.update({
 
            (dev, L9['color']): scale(colmap[n], effectSettings.get(L9['strength'], 1)),
 
            (dev, L9['zoom']): effectSettings.get(L9['zoom'], .5),
 
            })
 
        out.update({
 
            (dev, L9['rx']):
 
            lerp(.3, .8, nsin(songTime / period + n / 4)),
 
            (dev, L9['ry']): effectSettings.get(L9['ry'], .5),
 
            })
 
    return out
 

	
 
chase1_members = [
 
        DEV['backlight1'],
 
        DEV['lip1'],
 
        DEV['backlight2'],
 
        DEV['down2'],
 
        DEV['lip2'],
 
        DEV['backlight3'],
 
        DEV['down3'],
 
        DEV['lip3'],
 
        DEV['backlight4'],
 
        DEV['down4'],
 
        DEV['lip4'],
 
@@ -233,25 +258,25 @@ def effect_chase1(effectSettings, streng
 
            col = scale(col, effectSettings.get(L9['strength'], 1))
 
            col = scale(col, (1 - dist / radius))
 
        
 
            out.update({
 
                (dev, L9['color']): col,
 
            })
 
    return out
 

	
 
def effect_chase2(effectSettings, strength, songTime, noteTime):
 
    members = chase2_members
 
    
 
    out = {}
 
    period = float(effectSettings.get(L9['period'], 2 / len(members)))
 
    period = float(effectSettings.get(L9['period'], 0.3))
 

	
 
    for i, dev in enumerate(members):
 
        cursor = (songTime / period) % float(len(members))
 
        dist = abs(i - cursor)
 
        radius = 3
 
        if dist < radius:
 
            col = effectSettings.get(L9['colorScale'], '#ffffff')
 
            col = scale(col, effectSettings.get(L9['strength'], 1))
 
            col = scale(col, (1 - dist / radius))
 
        
 
            out.update({
 
                (dev, L9['color']): col,
show/dance2018/effect.n3
Show inline comments
 
@@ -14,24 +14,25 @@
 
#     :publishAttr :strength .
 

	
 
#effect:Strobe a :Effect; rdfs:label "strobe"; :publishAttr :duty, :offset, :rate, :strength .
 

	
 

	
 
effect:animRainbow a :Effect; rdfs:label "animRainbow"; :publishAttr :strength, :rate ; :group "anim".
 
effect:aurawash a :Effect; :publishAttr :strength ; :group "anim".
 
effect:auraSparkles a :Effect; :publishAttr :strength ; :group "anim".
 
effect:pulseRainbow a :Effect; rdfs:label "pulseRainbow"; :publishAttr :strength, :rate ; :group "main"; :order 6.
 

	
 
effect:orangeSearch a :Effect; :publishAttr :strength ; :group "anim".
 
effect:qsweep a :Effect; :publishAttr :strength ; :group "anim".
 
effect:qsweepusa a :Effect; :publishAttr :strength ; :group "anim".
 
effect:chase1 a :Effect; :publishAttr :strength ; :group "anim".
 
effect:chase2 a :Effect; :publishAttr :strength ; :group "anim".
 

	
 
effect:lightning a :Effect; :publishAttr :strength ; :group "main"; :order 7.
 

	
 
effect:strobewarm :group "anim".
 

	
 
effect:house :group "main"; :order 3 .
 
effect:houseside :group "main"; :order 4 .
 
effect:cyc :group "main"; :order 3 .
 
effect:qwidecenter :group "main"; rdfs:label "qwidecenter [18]"; :order 5 .
 
effect:curtain2  :group "main"; :order 2 .
show/dance2018/song10.n3
Show inline comments
 
@@ -47,12 +47,14 @@ show:song10 :note <http://light9.bigaste
 
<http://light9.bigasterisk.com/show/dance2018/song10/n2c0> a :Curve;
 
     :attr :strength; :point <http://light9.bigasterisk.com/show/dance2018/song10/n2c0p0>, <http://light9.bigasterisk.com/show/dance2018/song10/n2c0p1>, <http://light9.bigasterisk.com/show/dance2018/song10/n2c0p2>, <http://light9.bigasterisk.com/show/dance2018/song10/n2c0p3> .
 
<http://light9.bigasterisk.com/show/dance2018/song10/n2c0p0> :time -1.13159e+02;
 
     :value 0e+00 .
 
<http://light9.bigasterisk.com/show/dance2018/song10/n2c0p1> :time -1.1139e+02;
 
     :value 0.2 .
 
<http://light9.bigasterisk.com/show/dance2018/song10/n2c0p2> :time 1.69662e+02;
 
     :value 0.2 .
 
<http://light9.bigasterisk.com/show/dance2018/song10/n2c0p3> :time 1.72661e+02;
 
     :value 0e+00 .
 
<http://light9.bigasterisk.com/show/dance2018/song10/n2set0> :effectAttr :colorScale;
 
     :value "#3a3c3a" .
 

	
 
effect:qsweepusa a :Effect; :publishAttr :strength ; :group "anim".
 
\ No newline at end of file
0 comments (0 inline, 0 general)