def fade_out_animation(cycles, color, duration): return LightAnimation(repeat=cycles, target_lights=["1"], sequence=[ AnimationStep(duration_ms=duration, blend=True, color=color.value), AnimationStep(duration_ms=1, blend=True, color=Colors.black.value) ])
def pulse_animation(cycles, color_one, color_two): return LightAnimation(repeat=cycles, target_lights=["1"], sequence=[ AnimationStep(duration_ms=500, blend=True, color=color_one.value), AnimationStep(duration_ms=1000, blend=True, color=color_two.value) ])
def flip_animation(cycles, color_one, color_two, duration_one, duration_two): return LightAnimation(repeat=cycles, target_lights=["1"], sequence=[ AnimationStep(duration_ms=duration_one, blend=False, color=color_one.value), AnimationStep(duration_ms=duration_two, blend=False, color=color_two.value) ])
def blink_animation(cycles, color): return LightAnimation(repeat=cycles, target_lights=["1"], sequence=[ AnimationStep(duration_ms=500, blend=False, color=color.value), AnimationStep(duration_ms=500, blend=False, color=Colors.black.value) ])
def build_breathe_animation(cycles, color, duration): return LightAnimation(repeat=cycles, target_lights=["1"], sequence=[ AnimationStep(duration_ms=1, blend=True, color="000000"), AnimationStep(duration_ms=duration, blend=True, color=color), AnimationStep(duration_ms=300, blend=True, color=color), AnimationStep(duration_ms=300, blend=True, color="000000") ])
def solid_animation(cycles, color, duration): return LightAnimation(repeat=cycles, target_lights=["1"], sequence=[ AnimationStep(duration_ms=duration, blend=False, color=color.value) ])
def build_button_up_animation_directive(target_gadgets): return SetLightDirective(version=1, target_gadgets=target_gadgets, parameters=SetLightParameters( trigger_event=TriggerEventType.buttonUp, trigger_event_time_ms=0, animations=[ LightAnimation(repeat=1, target_lights=["1"], sequence=[ AnimationStep( duration_ms=300, color="00FFFF", blend=False) ]) ]))
def set_idle_animation(params): animations = [ LightAnimation(**dict( animation, sequence=[AnimationStep(**s) for s in animation['sequence']])) for animation in params['animations'] ] trigger_event = TriggerEventType('none') parameters = SetLightParameters(animations=animations, trigger_event=trigger_event, trigger_event_time_ms=params.get( 'trigger_time', 0)) return SetLightDirective(version=1, target_gadget=params.get( 'target_gadgets', []), parameters=parameters)
blend=True, color=color), AnimationStep(duration_ms=300, blend=True, color=color), AnimationStep(duration_ms=300, blend=True, color="000000") ]) intro_animation = LightAnimation(repeat=15, target_lights=["1"], sequence=[ AnimationStep(duration_ms=200, blend=True, color="000000"), AnimationStep(duration_ms=300, blend=True, color="FF0000"), AnimationStep(duration_ms=300, blend=True, color="FFFF00"), AnimationStep(duration_ms=300, blend=True, color="00FF00"), AnimationStep(duration_ms=300, blend=True, color="00FFFF"), AnimationStep(duration_ms=300, blend=True,