def fade_animation(cycles, color, duration):
    return LightAnimation(repeat=cycles,
                          target_lights=["1"],
                          sequence=[
                              AnimationStep(duration_ms=duration,
                                            blend=True,
                                            color=color.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)
                          ])
コード例 #5
0
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)
                                                    ])
                                 ]))
コード例 #6
0
 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)
コード例 #7
0
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 breathe_animation(cycles, color, duration):
    return LightAnimation(repeat=cycles,
                          target_lights=["1"],
                          sequence=[
                              AnimationStep(duration_ms=1,
                                            blend=True,
                                            color=Colors.black.value),
                              AnimationStep(duration_ms=duration,
                                            blend=True,
                                            color=color.value),
                              AnimationStep(duration_ms=300,
                                            blend=True,
                                            color=color.value),
                              AnimationStep(duration_ms=300,
                                            blend=True,
                                            color=Colors.black.value)
                          ])
コード例 #9
0
                          ])


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,
                                                   color="0000FF"),
                                     AnimationStep(duration_ms=300,
                                                   blend=True,
                                                   color="FF00FF")
                                 ])

breath_animation_red = build_breathe_animation(30, 'FF0000', 1000)
breath_animation_green = build_breathe_animation(30, '00FF00', 1000)