Skip to content

Allow changing start point of the animation for Comets #131

@skjdghsdjgsdj

Description

@skjdghsdjgsdj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions