adafruit / adafruit/Adafruit_CircuitPython_LED_Animation

Allow changing start point of the animation for Comets

Open
#131 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
62
Forks
46
PR merge metrics
No merged PRs in 30d

Description

I'm using a Comet animation on 60-pixel Neopixel-compatible ring. By necessity, the LED ring is mounted an enclosure such that pixel 0 isn't at 0°, but offset by 123°. In other words, the pixel at 0° looks like pixel number 21 or so on the ring when viewed from the enclosure.

I found a way to do it, but it's cheating considering I'm accessing a protected class member:

```python
comet = Comet(
neopixels,
speed = 0.03,
color = (255, 0, 0),
tail_length = 10,
bounce = False,
ring = True
)

comet._tail_start = 21 # ⚠️ forcing an offset, but using a protected member

while True:
animations.animate()
```
Perhaps `_tail_start` can be promoted to an argument passed to the constructor, defaulting to 0?

Incidentally, the `_tail_start` affects the _dimmest_ pixel in the animation when using the default clockwise rotation, which makes sense as the start point affects the first LED to be rendered in the animation. I also had to offset it further by the length of the tail. That's arguably expected behavior that could be documented, but I imagine might trip up someone.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.