Skip to content

Commit 9010299

Browse files
committed
Fill fix, more docs.
1 parent 81a3174 commit 9010299

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

adafruit_led_animation/animation.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def animate(self):
8282
"""
8383
Call animate() from your code's main loop. It will draw the animation draw() at intervals
8484
configured by the speed property (set from init).
85+
8586
:return: True if the animation draw cycle was triggered, otherwise False.
8687
"""
8788
if self._paused:
@@ -133,6 +134,7 @@ def fill(self, color):
133134
Fills the pixel object with a color.
134135
"""
135136
self.pixel_object.fill(color)
137+
self.show()
136138

137139
@property
138140
def color(self):
@@ -343,8 +345,26 @@ class AnimationSequence:
343345
Advances manually or at the specified interval.
344346
345347
: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
347349
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()
348368
"""
349369
def __init__(self, *members, advance_interval=None, auto_clear=False):
350370
self._members = members
@@ -405,8 +425,7 @@ def freeze(self):
405425

406426
def resume(self):
407427
"""
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.
410429
"""
411430
if not self._paused:
412431
return
@@ -419,8 +438,13 @@ def resume(self):
419438

420439
class AnimationGroup:
421440
"""
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+
424448
"""
425449
def __init__(self, *members, sync=False):
426450
self._members = members
@@ -435,7 +459,6 @@ def animate(self):
435459

436460
return any([item.animate() for item in self._members])
437461

438-
439462
def _for_all(self, method, *args, **kwargs):
440463
for item in self._members:
441464
getattr(item, method)(*args, **kwargs)

0 commit comments

Comments
 (0)