adafruit / adafruit/Adafruit_CircuitPython_LED_Animation
Allow changing start point of the animation for Comets
- Vorherrschende Sprache
- Python
- Sterne
- 62
- Forks
- 46
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne damit, die Klasse Comet zu finden und ihren Konstruktor sowie die aktuelle Behandlung von _tail_start zu untersuchen. Füge dann die angeforderte öffentliche Startpunkt-Option mit einem Standardwert von 0 hinzu, überprüfe anschließend den Offset der Ringanimation und dokumentiere, wie sich die Länge des Tails auf das sichtbare Startpixel auswirkt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- embedded-iot
- Issue-Typ
- Feature
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 55/100