コード例 #1
0
 def fill_out(self, reverse=False):
     if reverse:
         FillAnimation(LinearFloatFunc(0.0, 1.0),
                       ConstFloatFunc(1.0)).apply()
     else:
         FillAnimation(ConstFloatFunc(0.0), LinearFloatFunc(1.0,
                                                            0.0)).apply()
コード例 #2
0
 def snake(self, tail=1.0, switch_direction=False):
     if isinstance(tail, str):
         tail = {short: 0.25, medium: 1.0, long: 4.0}[tail]
     if switch_direction:
         SnakeAnimation(LinearFloatFunc(1.0, 0.0 - tail),
                        ConstFloatFunc(tail),
                        ConstBooleanFunc(not switch_direction)).apply()
     else:
         SnakeAnimation(LinearFloatFunc(0.0, 1.0 + tail),
                        ConstFloatFunc(tail),
                        ConstBooleanFunc(not switch_direction)).apply()
コード例 #3
0
 def fade_in(self):
     BrightnessAnimation(LinearFloatFunc(0.0, 1.0)).apply()
コード例 #4
0
 def segment_down(self, length=0.25):
     FillAnimation(LinearFloatFunc(1.0 - length, 0.0),
                   LinearFloatFunc(1.0, length)).apply()
コード例 #5
0
 def segment_up(self, length=0.25):
     FillAnimation(LinearFloatFunc(0.0, 1.0 - length),
                   LinearFloatFunc(length, 1.0)).apply()
コード例 #6
0
 def segment_saw_tooth(self, length=0.25):
     FillAnimation(
         HalfFloatFunc(LinearFloatFunc(0.0, 1.0 - length),
                       LinearFloatFunc(1.0 - length, 0.0)),
         HalfFloatFunc(LinearFloatFunc(length, 1.0),
                       LinearFloatFunc(1.0, length))).apply()
コード例 #7
0
 def fill_out_in(self, edge=1.0):
     FillAnimation(
         ConstFloatFunc(0.0),
         HalfFloatFunc(LinearFloatFunc(1.0, 1 - edge),
                       LinearFloatFunc(1 - edge, 1.0))).apply()
コード例 #8
0
def fade_out(timing):
    return BrightnessAnimation(timing, LinearFloatFunc(1.0, 0.0))
コード例 #9
0
 def fill(self):
     FillAnimation(ConstFloatFunc(0.0), LinearFloatFunc(0.0, 1.0)).apply()
コード例 #10
0
def colors_colide(timing, number_of_pixels=3, cycles_for_colide=4):
    liner_drop = LinearFloatFunc(0.8, 0.0)
    saw_tooth = RepeatFloatFunc.from_timing(timing, cycles_for_colide,
                                            liner_drop)
    return AlternateAnimation(timing, number_of_pixels,
                              equal_spreads.change_on_cycle(timing), saw_tooth)
コード例 #11
0
 def hue_saw_tooth(self, edge=0.1, reverse=False):
     if isinstance(edge, str):
         edge = {soft: 0.04, medium: 0.08, hard: 0.2, total: 0.35}[edge]
     if reverse:
         edge = -edge
     HueShiftAnimation(LinearFloatFunc(0.0, edge)).apply()
コード例 #12
0
def hue_shift_smooth(timing):
    return HueShiftAnimation(timing,
                             LinearFloatFunc.from_timing(timing, 0.0, 1.0))
コード例 #13
0
ファイル: fade.py プロジェクト: blumamir/leds-seq-creator
from infra.animations_factory import effect, color
from infra.timing import beats, cycle, get_timing, set_timing
from led_objects.groups import group1, group2, group8, group3, group6, group4, group7, group5
from led_objects.objects_selector import elements

front_to_back = [
    group1, [group2, group8], [group3, group6], group4, group7, group5
]
back_to_front = list(reversed(front_to_back))
right_to_left = [[group3, group4], [group2, group7], [group8],
                 [group1, group5], group6]
left_to_right = list(reversed(right_to_left))

spcial_order = [front_to_back, back_to_front, right_to_left, left_to_right]

fade_out_options = [BrightnessAnimation(LinearFloatFunc(1.0, 0.0))]

fill_out_options = [
    FillAnimation(ConstFloatFunc(0.0), LinearFloatFunc(1.0, 0.0)),
    FillAnimation(LinearFloatFunc(0.0, 1.0), ConstFloatFunc(1.0)),
    FillAnimation(LinearFloatFunc(0.0, 0.5), LinearFloatFunc(1.0, 0.5))
]

out_options = [fade_out_options, fill_out_options]


def get_random_fade_func():
    func_class = random.choice(out_options)
    return random.choice(func_class)

コード例 #14
0
def moving_full_rainbow(timing):
    return Rainbow(timing, LinearFloatFunc.from_timing(timing, start=0.0),
                   LinearFloatFunc.from_timing(timing, start=1.0))
コード例 #15
0
 def fade_out(self):
     BrightnessAnimation(LinearFloatFunc(1.0, 0.0)).apply()
コード例 #16
0
 def fill_in_out(self, edge=1.0):
     FillAnimation(
         ConstFloatFunc(0.0),
         HalfFloatFunc(LinearFloatFunc(0.0, edge),
                       LinearFloatFunc(edge, 0.0))).apply()
コード例 #17
0
 def saw_tooth(self, edge=0.6, reverse=False):
     if isinstance(edge, str):
         edge = {soft: 0.4, medium: 0.6, hard: 0.8, total: 1.0}[edge]
     min_val = 1.0 - edge if reverse else 1.0
     max_val = 1.0 if reverse else 1.0 - edge
     BrightnessAnimation(LinearFloatFunc(min_val, max_val)).apply()
コード例 #18
0
def fade_in(timing):
    return BrightnessAnimation(timing, LinearFloatFunc(0.0, 1.0))