Commit graph

10 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
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
dherrada
4ada0c2017 Ran pre-commit, added licenses 2021-01-12 10:37:24 -05:00
Roy Hooper
d9fe17e91a remove self from copyright, authors 2020-08-16 20:34:18 -04:00
Roy Hooper
76a3e43969 a bunch of protocol changes to allow a second stage of drawing, and to move the cycle done callback out to animate() 2020-05-18 16:27:38 -04:00
Kattni Rembor
74b0f6c12c Docs, pylint. 2020-05-17 15:00:13 -04:00
Roy Hooper
cdd61d6be1 split library up further to help with low memory boards 2020-05-16 14:11:17 -04:00