@@ -82,6 +82,7 @@ def animate(self):
82
82
"""
83
83
Call animate() from your code's main loop. It will draw the animation draw() at intervals
84
84
configured by the speed property (set from init).
85
+
85
86
:return: True if the animation draw cycle was triggered, otherwise False.
86
87
"""
87
88
if self ._paused :
@@ -133,6 +134,7 @@ def fill(self, color):
133
134
Fills the pixel object with a color.
134
135
"""
135
136
self .pixel_object .fill (color )
137
+ self .show ()
136
138
137
139
@property
138
140
def color (self ):
@@ -343,8 +345,26 @@ class AnimationSequence:
343
345
Advances manually or at the specified interval.
344
346
345
347
:param members: The animation objects or groups.
346
- :param advance_interval: Time in seconds between animations if cycling automatically. Defaults
348
+ :param int advance_interval: Time in seconds between animations if cycling automatically. Defaults
347
349
to ``None``.
350
+
351
+ .. code-block:: python
352
+
353
+ from adafruit_led_animation.animation import AnimationSequence, Blink, Comet, Sparkle
354
+ import adafruit_led_animation.color as color
355
+ import board
356
+ import neopixel
357
+
358
+ strip_pixels = neopixel.NeoPixel(board.A1, 30, brightness=1, auto_write=False)
359
+
360
+ blink = Blink(strip_pixels, 0.2, color.RED)
361
+ comet = Comet(strip_pixels, 0.1, color.BLUE)
362
+ sparkle = Sparkle(strip_pixels, 0.05, color.GREEN)
363
+
364
+ animations = AnimationSequence(blink, comet, sparkle, advance_interval=1)
365
+
366
+ while True:
367
+ animations.animate()
348
368
"""
349
369
def __init__ (self , * members , advance_interval = None , auto_clear = False ):
350
370
self ._members = members
@@ -405,8 +425,7 @@ def freeze(self):
405
425
406
426
def resume (self ):
407
427
"""
408
- Resume the current animation in the sequence and resumes auto advance
409
- if enabled.
428
+ Resume the current animation in the sequence, and resumes auto advance if enabled.
410
429
"""
411
430
if not self ._paused :
412
431
return
@@ -419,8 +438,13 @@ def resume(self):
419
438
420
439
class AnimationGroup :
421
440
"""
422
- A group of animations that are active together, such as a strip of
423
- pixels connected to and the onboard NeoPixels on a CPX or CPB.
441
+ A group of animations that are active together. An example would be grouping a strip of
442
+ pixels connected to a board and the onboard LED.
443
+
444
+ :param members: The animation objects or groups.
445
+ :param bool sync: Synchronises the timing of all members of the group to the settings of the
446
+ first member of the group. Defaults to ``False``.
447
+
424
448
"""
425
449
def __init__ (self , * members , sync = False ):
426
450
self ._members = members
@@ -435,7 +459,6 @@ def animate(self):
435
459
436
460
return any ([item .animate () for item in self ._members ])
437
461
438
-
439
462
def _for_all (self , method , * args , ** kwargs ):
440
463
for item in self ._members :
441
464
getattr (item , method )(* args , ** kwargs )
0 commit comments