adafruit / adafruit/Adafruit_CircuitPython_LED_Animation

Allow changing start point of the animation for Comets

Aperta
#131 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
62
Fork
46
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia individuando la classe Comet e analizzando il suo costruttore e la gestione attuale di _tail_start. Aggiungi quindi l’opzione pubblica per il punto di inizio richiesta, con un valore predefinito pari a 0, verifica l’offset dell’animazione dell’anello e documenta in che modo la lunghezza della coda influisce sul pixel iniziale visibile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
embedded-iot
Tipo di issue
Funzionalità
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.