Commit graph

111 commits

Author SHA1 Message Date
hberg32
9cb567f013
Fix initial offset calculation when reversed in chase.py
Found a bug in the chase animation when reverse is set to True which results in the animation being offset by the length of the size parameter.  You can observe this by setting up two animations of equal length on a single strip of pixels with the second one reversed.  The bars should appear to meet in the middle but don't.

Example:
pixels = neopixel.NeoPixel(board.A0, 22, auto_write=False, brightness = .5)
left_pixels = PixelSubset(pixels, 0, 11)
right_pixels = PixelSubset(pixels, 11, 22)
left_animation = Chase(
    left_pixels, speed=.5, color=CYAN, size=2, spacing=11
)

right_animation = Chase(
    right_pixels, speed=.5, color=CYAN, size=2, spacing=11, reverse=True
)

animations = AnimationSequence(
    AnimationGroup(
        left_animation,
        right_animation,
        sync=True
    ),
    auto_clear=True,
    auto_reset=True,
)

while True:
    animations.animate()
2025-07-31 16:41:58 -04:00
foamyguy
d06c5ca9df change to ruff 2025-05-16 16:29:36 +00:00
jposada2020
a8e057cf93 adding pacman animation 2025-02-09 22:48:07 -05:00
jposada2020
bfdbe0078c adding Pacman Animation 2025-02-09 22:47:22 -05:00
jposada2020
34bcf3c535 formating 2025-02-05 17:10:48 -05:00
jposada2020
c7dc901791 Blink animation with a user selected background color 2025-02-05 17:02:54 -05:00
foamyguy
0b66cc1c11 add period property to pulse and sparklepulse, fix typo 2024-12-20 17:56:28 -06:00
foamyguy
6ef0715b77 integer division 2024-12-16 14:47:32 -06:00
foamyguy
bac273b46d rainbow commet fix for tail_length > 256 2024-12-13 11:52:07 -06:00
foamyguy
ee5301b938 format 2024-12-13 10:56:56 -06:00
foamyguy
7dc67c5c70 add docstring 2024-12-13 10:45:59 -06:00
foamyguy
5badc804f7 public property for rainbow.period 2024-12-13 10:36:07 -06:00
indomitableSwan
3d91a78621 Move misplaced computation of wheel_index into the case for precompute_rainbow=True 2024-08-21 15:14:52 -04:00
Samed Ozdemir
ef3ab8ae2d fix: move pulse generator from helper to own file to reduce memory footprint when imported 2024-07-06 11:50:39 -04:00
foamyguy
251bcd13cf
Merge pull request #116 from tylerwinfield/main
Restores min_intensity and max_intensity for Pulse animation and smoother transition option
2024-01-28 18:42:19 -06:00
Tyler Winfield
786cd806fc Resolving build CI errors 2023-12-28 09:01:11 -06:00
tneish
cba51fb34b
Update adafruit_led_animation/animation/colorcycle.py
Adding the new arg to the end will make any calls upward.compatible

Co-authored-by: Dan Halbert <halbert@halwitz.org>
2023-12-27 22:40:48 +01:00
tneish
43aa654b4d cycle complete at start_color 2023-12-27 22:33:33 +01:00
Tyler Winfield
f16e519991 Corrected variable scoping 2023-12-19 23:04:12 -06:00
Tyler Winfield
fc1aefafca Adds min_intensity and max_intensity support back to Pulse animation. Introduces a 'breath' value (default 0) to give a duration to hold the minimum and maximum intensity during the animation for smoother changes in direction. 2023-12-19 22:01:30 -06:00
tneish
da467ce9b7 Fix pylint errors 2023-12-16 11:23:17 +01:00
tneish
cce709470f ColorCycle accepts start color 2023-12-16 11:15:27 +01:00
foamyguy
e23e57b421 reuse formatting. add examples for new functionality 2023-06-29 19:36:32 -05:00
foamyguy
fe11f17986 Merge branch 'main' into timed-animation 2023-06-29 18:59:01 -05:00
Tekktrik
46f1be6bce Run pre-commit 2023-05-10 22:36:01 -04:00
foamyguy
0629e1418e Merge branch 'main' into multicolor_comet
# Conflicts:
#	adafruit_led_animation/animation/comet.py
2023-02-24 17:26:50 -06:00
foamyguy
3aaa75efbf add star arg and docstring for name 2023-02-24 17:24:48 -06:00
Taylor Yu
38af7a0c39 comet: add doc for background_color
Add missing documentation for the recently-added `background_color`
parameter to `Comet`.

Signed-off-by: Taylor Yu <code@argon.blue>
2023-01-25 08:28:40 -06:00
Alec Delaney
b101ab80e8
Merge pull request #108 from tlyu/rainbowcomet-init
rainbowcomet: add missing arg initing base class
2023-01-23 19:49:06 -08:00
Taylor Yu
a2c36c659a fix doc of bounce
Fix documentation of the default `bounce` value for `Comet` and
`RainbowComet`.

Signed-off-by: Taylor Yu <code@argon.blue>
2023-01-22 14:50:21 -06:00
Taylor Yu
58bc776678 rainbowcomet: add missing arg initing base class
In RainbowComet, the call to `super().__init__()` was missing the
`background_color` argument. This caused strange effects when
non-default arguments were passed.

For example, setting `reverse=True` resulted a red comet with a
tail length of 1, and setting `bounce=True` resulted in a reversed
rainbow comet.

Signed-off-by: Taylor Yu <code@argon.blue>
2023-01-22 14:38:02 -06:00
priestbh
85e4d6ee1b
Update comet.py 2022-12-30 14:52:01 -05:00
priestbh
bc0298b35a
Update comet.py to include a background color
Update comet.py to include a background color other than BLACK
2022-12-30 14:43:00 -05:00
foamyguy
9179e7c25a adding multicolor comet animation 2022-12-17 11:49:12 -06:00
73d5f61c6e
Optimize comet draw
The big pay-off is avoiding enumerate(). Removing redundant
comparisons of _ring() and avoiding modulo operations help too.
2022-11-10 16:51:02 -06:00
914bb8060b
speed bar generation by not querying pixels
In a test this improved speed substantially, nearly doubling
the speed of the following test program
```python
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=1, auto_write=False, pixel_order="RGB")
evens = helper.PixelMap(pixels, [(i,) for i in range(0, pixel_num, 2)], individual_pixels=True)
animation = RainbowChase(evens, 0, spacing=8)
t0 = adafruit_ticks.ticks_ms()
while True:
    for i in range(10):
        animation.animate(show=False)
    t1 = adafruit_ticks.ticks_ms()
    print(f"{10000/(t1-t0):.0f}fps")
    t0 = t1
```

Performance on Raspberry Pi Pico W:
Before: ~85fps
After: ~140fps

This also happens to make it compatible with an in-process PR that adds
a fast PixelMap-like class to the core, but which doesn't support
getitem.
2022-11-10 16:48:35 -06:00
Alec Delaney
24319aac5d
Fix pylint errors 2022-11-07 20:34:04 -05:00
Alec Delaney
c19e802c65 Fix release CI files 2022-11-04 09:12:45 -04:00
Alec Delaney
4326d9e9dd Update version string 2022-08-16 18:09:15 -04:00
dherrada
9fde73f3dc Pylint and RTD update patch, and other fixes 2021-11-11 15:33:12 -05:00
Kattni
8d378fa2ed
Merge pull request #84 from rhooper/sparkle-mask
Move sparkle mask example to own file to make mergeable
2021-10-31 15:55:05 -04:00
Kattni
76d419afc6
Merge pull request #78 from plugowski/master
Fixed reverse mode for Comet / RainbowComet animation.
2021-10-31 15:52:26 -04:00
Rose Hooper
4d6c98ff0d Merge branch 'main' into sparkle-mask 2021-10-31 15:14:06 -04:00
Kattni Rembor
1f17980222 Sphinx. 2021-09-23 17:50:42 -04:00
Paweł Ługowski
a18eb1134c pre-commit code reformat 2021-05-18 12:01:57 +07:00
Paweł Ługowski
da7484427c Fixed reverse mode for Comet / RainbowComet animation. 2021-05-03 10:49:41 +07:00
dherrada
4ada0c2017 Ran pre-commit, added licenses 2021-01-12 10:37:24 -05:00
Karan Bhatia
0fea0a48f1 added black recommended change 2020-11-25 00:29:59 -05:00
karan bhatia
b5e93fd414 updated code based on pylint and PR feedback. 2020-11-24 13:29:37 -05:00
karan bhatia
c3b868b880 fixed formating issue identified by black and pylint 2020-11-23 14:35:05 -05:00