Finalise example updates and bugfixes.

This commit is contained in:
Kattni Rembor 2020-05-22 20:49:16 -04:00
parent 0f9ae69a78
commit 210fa1d7d1
4 changed files with 9 additions and 9 deletions

View file

@ -103,7 +103,9 @@ class AnimationSequence:
name=None
):
if advance_interval and advance_on_cycle_complete:
raise ValueError("Cannot use both advance_interval and advance_on_cycle_complete.")
raise ValueError(
"Cannot use both advance_interval and advance_on_cycle_complete."
)
self._members = members
self._advance_interval = (
advance_interval * NANOS_PER_SECOND if advance_interval else None

View file

@ -35,15 +35,15 @@ pixel_num = 32
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.2, auto_write=False)
solid = Solid(pixels, color=PINK)
colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, ORANGE, TEAL])
blink = Blink(pixels, speed=0.5, color=JADE)
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
colorcycle = ColorCycle(pixels, speed=0.4, colors=[MAGENTA, ORANGE, TEAL])
chase = Chase(pixels, speed=0.1, color=WHITE, size=3, spacing=6)
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
pulse = Pulse(pixels, speed=0.1, color=AMBER, period=3)
animations = AnimationSequence(
solid, comet, blink, chase, colorcycle, pulse, advance_interval=5, auto_clear=True,
solid, blink, colorcycle, chase, comet, pulse, advance_interval=5, auto_clear=True,
)
while True:

View file

@ -40,7 +40,7 @@ comet_h = Comet(
comet_v = Comet(pixel_wing_vertical, speed=0.1, color=AMBER, tail_length=6, bounce=True)
chase_h = Chase(pixel_wing_horizontal, speed=0.1, size=3, spacing=6, color=JADE)
rainbow_chase_v = RainbowChase(
pixel_wing_vertical, speed=0.1, size=3, spacing=2, wheel_step=8
pixel_wing_vertical, speed=0.1, size=3, spacing=2, step=8
)
rainbow_comet_v = RainbowComet(
pixel_wing_vertical, speed=0.1, tail_length=7, bounce=True

View file

@ -19,16 +19,14 @@ pixel_pin = board.D6
# Update to match the number of NeoPixels you have connected
pixel_num = 32
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.2, auto_write=False)
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.1, auto_write=False)
blink = Blink(pixels, speed=0.5, color=JADE)
comet = Comet(pixels, speed=0.01, color=PURPLE, tail_length=10, bounce=True)
chase = Chase(pixels, speed=0.1, size=3, spacing=6, color=AMBER)
animations = AnimationSequence(
comet, blink, chase, advance_interval=5, auto_clear=True, random_order=True,
)
animations = AnimationSequence(blink, comet, chase, advance_interval=3, auto_clear=True)
while True:
animations.animate()