-
Notifications
You must be signed in to change notification settings - Fork 46
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:
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.