Changeset - 3ed6a6b39f39
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 15 years ago 2010-06-20 23:15:57
drewp@bigasterisk.com
rewrite stack()
Ignore-this: f4540894080f2714fb411c6385d2975f
1 file changed with 18 insertions and 16 deletions:
0 comments (0 inline, 0 general)
light9/Effects.py
Show inline comments
 
@@ -29,25 +29,27 @@ def chase(t, ontime=0.5, offset=0.2, onv
 

	
 
    return Submaster.Submaster(leveldict=lev, temporary=True)
 

	
 
def stack(t, names=None):
 
    """names is list of URIs. returns a submaster that stacks the the inputs"""
 
    frac = 1.0 / (len(names) + 1)
 
    threshold = frac
 
def stack(t, names=None, fade=0):
 
    """names is list of URIs. returns a submaster that stacks the the inputs
 

	
 
    fade=0 makes steps, fade=1 means each one gets its full fraction
 
    of the time to fade in. Fades never...
 
    """
 
    frac = 1.0 / len(names)
 

	
 
    lev = {}
 
    for uri in names:
 
        try:
 
            dmx = Patch.dmx_from_uri(uri)
 
        except KeyError:
 
            print ("stack includes %r, which doesn't resolve to a dmx chan" %
 
                   uri)
 
            continue
 
        lev[dmx] = 1
 

	
 
        threshold += frac
 
        if threshold > t:
 
    for i, uri in enumerate(names):
 
        if t >= (i + 1) * frac:
 
            try:
 
                dmx = Patch.dmx_from_uri(uri)
 
            except KeyError:
 
                print ("stack includes %r, which doesn't resolve to a dmx chan"%
 
                       uri)
 
                continue
 
            lev[dmx] = 1
 
        else:
 
            break
 

	
 
    
 
    return Submaster.Submaster(leveldict=lev, temporary=True)
 

	
 
def configExprGlobals():
0 comments (0 inline, 0 general)