GithubHelp home page GithubHelp logo

vtt-info / neopixel-uanimate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lavron/neopixel-uanimate

0.0 0.0 0.0 1.62 MB

Animation controller for the addressable LED-strips. Micropython's implementation for ESP32.

License: MIT License

Python 100.00%

neopixel-uanimate's Introduction

Neopixel uAnimate

Micropython library for the animations on the Neopixels (WS2812 etc)

Getting Started

Import library and/or animations

import time
from neopixel_animate import NeopixelAnimate, PulseAnimation

Initiate animation

strip_len = 24
duration_ms = 1000
breath = PulseAnimation(strip_len, duration_ms, color=BLUE)

breath.start()

while True:
    frame = breath.get_frame()
    if frame:
        for i in range(strip_len):
            strip[i] = frame[i]
        strip.write()

Basic animations

Three basic animations included:

  1. Rainbow
  2. Pulse
  3. Rotate

video with example_simple.py running on the WS2812B strip

Check this video with example_simple.py running on the WS2812B strip: https://www.youtube.com/watch?v=a1_O9AnuGB0

Custom animations

You can extend the controler with own animations. Defined 'frame()' method should accept 'offset' argument (between 0 and 1), and set color for every self.leds[el].

Be sure to pass strip length and loop duration in ms.

# filling strip with BLUE from bottom to top
class FillAnimation(NeopixelAnimate):
    def frame(self, offset):
        active_px = int(self.len * offset)
        for i in range(self.len):
            self.leds[i] = BLUE if i <= active_px else BLACK

#callback example
def fill_animation_callback():
    print("Fill animation completed")


fill = FillAnimation(strip_len, 3000, color_passed_to_fill=GREEN,
                     loop=False, callback=fill_animation_callback)

License

This project is licensed under the MIT License - see the LICENSE.md file for details

neopixel-uanimate's People

Contributors

lavron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.