@@ -386,6 +386,7 @@ def draw(self):
386
386
self .fill (color )
387
387
self .show ()
388
388
389
+
389
390
class SparklePulse (Animation ):
390
391
"""
391
392
Combination of the Spark and Pulse animations.
@@ -399,7 +400,9 @@ class SparklePulse(Animation):
399
400
"""
400
401
401
402
# pylint: disable=too-many-arguments
402
- def __init__ (self , pixel_object , speed , color , period = 5 , max_intensity = 1 , min_intensity = 0 ):
403
+ def __init__ (
404
+ self , pixel_object , speed , color , period = 5 , max_intensity = 1 , min_intensity = 0
405
+ ):
403
406
if len (pixel_object ) < 2 :
404
407
raise ValueError ("Sparkle needs at least 2 pixels" )
405
408
self .max_intensity = max_intensity
@@ -432,14 +435,19 @@ def draw(self):
432
435
now = monotonic_ns ()
433
436
time_since_last_draw = (now - self ._last_update ) / NANOS_PER_SECOND
434
437
self ._last_update = now
435
- pos = self ._cycle_position = (self ._cycle_position + time_since_last_draw ) % self ._period
438
+ pos = self ._cycle_position = (
439
+ self ._cycle_position + time_since_last_draw
440
+ ) % self ._period
436
441
if pos > self ._half_period :
437
442
pos = self ._period - pos
438
- intensity = self .min_intensity + (pos * self ._intensity_delta * self ._position_factor )
443
+ intensity = self .min_intensity + (
444
+ pos * self ._intensity_delta * self ._position_factor
445
+ )
439
446
color = [int (self .color [n ] * intensity ) for n in range (self ._bpp )]
440
447
self .pixel_object [pixel ] = color
441
448
self .show ()
442
449
450
+
443
451
class Chase (Animation ):
444
452
"""
445
453
Chase pixels in one direction in a single color, like a theater marquee sign.
0 commit comments