Skip to content

Issues with Sparkle and SparklePulse animations #48

Closed
@nnja

Description

@nnja

I noticed the following issues with Sparkle animations:

  • Sparkle will never sparkle the first or last pixel
  • SparklePulse animates one less pixel than defined in pixel_num, the last pixel is always off

Simple SparklePulse example that will only light up 4 pixels, not 5:

import board
import neopixel
from adafruit_led_animation.animation.sparklepulse import SparklePulse
from adafruit_led_animation.color import RED

pixels = neopixel.NeoPixel(board.D12, 5, brightness=0.5, auto_write=False)
animation = SparklePulse(pixels, speed=0.1, period=3, color=RED)
while True:
    animation.animate()

The same issue does not affect the regular Pulse animation.

Simple Sparkle example that doesn't sparkle the first or last pixel:

import board
import neopixel
from adafruit_led_animation.animation.sparkle import Sparkle
from adafruit_led_animation.color import RED

pixels = neopixel.NeoPixel(board.D12, 5, brightness=0.5, auto_write=False)
animation = Sparkle(pixels, speed=0.2, color=RED, num_sparkles=10)
while True:
    animation.animate()

I tried to fix this one myself but wasn't able to narrow down the cause of the issue.

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