#!/usr/bin/python2 """Simple demo of oscillating colors.""" from __future__ import division, print_function import color import constants import fish_render import time import random try: import lumiversepython except ImportError: have_lumiversepython = False from DummyRig import DummyRig else: have_lumiversepython = True 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()