1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/usr/bin/python2
"""Simple demo of oscillating colors."""
from __future__ import division, print_function
import color
import constants
import fish_render
import sunrise
import time
import random
try:
import lumiversepython
except ImportError:
have_lumiversepython = False
from DummyRig import DummyRig
else:
have_lumiversepython = True
#fish_render = sunrise
def get_all_lights(rig):
"""Return a list of all panels."""
return [
[
fish_render.Light(
x, int(y == 'top'),
rig.select('$side={y}[$sequence={x}]'.format(y=y, x=x))
) for y in ('top', 'bot')
] for x in xrange(1, 200)
]
def demo(lights, rig):
"""Do some light things."""
#fish = fish_render.Fish(0, 0, 15, 1.5, color.black, 0.05 / constants.FRAME_RATE)
#fish = fish_render.Fish(0, 0, 23, 1.5, color.RGB(193 / 255, 68 / 255, 227 / 255), 0.05 / constants.FRAME_RATE)
fish = fish_render.Fish(0, 0, 23, 1.5, color.black, 0.05 / constants.FRAME_RATE)
bridge = fish_render.Bridge(lights, fish, rig)
current_time = time.time()
count = 0
while True:
bridge.update()
if count % constants.FRAME_RATE == 0:
time_delta = time.time() - current_time
print(time_delta)
current_time = time.time()
#time.sleep(1 / constants.FRAME_RATE)
count += 1
def main():
"""Run show."""
if have_lumiversepython:
rig = lumiversepython.Rig('/home/teacher/Lumiverse/PBridge.rig.json')
else:
rig = DummyRig(200, 2)
rig.init()
lights = get_all_lights(rig)
demo(lights, rig)
if __name__ == '__main__':
main()
|