adafruit / adafruit/Adafruit_CircuitPython_LED_Animation

what is the easiest way to do a `fadeOn` animation?

Offen
#128 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
question
Vorherrschende Sprache
Python
Sterne
62
Forks
46
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

i would like to do some animations - and to start with the sequence i like some `fadeOn` animation.

sadly i did not find a simple way to do this..

i tried with
```python
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
# based on
# https://learn.adafruit.com/circuitpython-led-animations/basic-animations#full-example-code-3063749

"""
just fadeOn to a solid color -
wait a little
and fadeOff again.
"""

import time
import board

# from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.animation.colorcycle import ColorCycle
from adafruit_led_animation.color import (
AMBER,
BLACK,
)
from adafruit_led_animation.sequence import AnimateOnce

# Update to match the number of NeoPixels you have connected
pixel_num = 1

print("\n\n")
print("fade experiment")

if hasattr(board, "APA102_SCK"):
import adafruit_dotstar
pixels = adafruit_dotstar.DotStar(
board.APA102_SCK, board.APA102_MOSI, pixel_num, auto_write=False
)
else:
import neopixel
pixels = neopixel.NeoPixel(board.NEOPIXEL, pixel_num, auto_write=False)

pixels.brightness = 0.3

fadeOnCC = ColorCycle(pixels, speed=5, colors=[BLACK, AMBER])
fadeOffCC = ColorCycle(pixels, speed=5, colors=[AMBER, BLACK])

fadeOn = AnimateOnce(
fadeOnCC,
# auto_clear=False,
# auto_reset=True,
advance_interval=5,
)
fadeOff = AnimateOnce(
fadeOffCC,
# auto_clear=False,
# auto_reset=True,
advance_interval=5,
)

print("wait 5sec")
time.sleep(5)

print("start fadeOn:")
while fadeOn.animate():
pass
print("done.")

print("wait 5sec")
time.sleep(5)

print("start fadeOff:")
while fadeOff.animate():
pass
print("done.")

print("wait 10sec")
time.sleep(10)
print("done with this script. exiting.")
# while True:
# pass

```

i think i am missing some basics here..

i think a working example just for a `fadeIn` and `fadeOut` is a good idea for the documentation :-)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit dem bereitgestellten ColorCycle- und AnimateOnce-Beispiel einschließlich der Einstiegspunkte fadeOnCC und fadeOffCC. Prüfe die vorhandene Animationsdokumentation, um die passende Stelle zum Hinzufügen eines einfachen Fade-in- und Fade-out-Beispiels zu finden. Erledigt ist die Aufgabe, wenn die Dokumentation eine funktionierende Sequenz zeigt, die eine Volltonfarbe ein- und ausblendet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.