description | A browser-based simulator of LED matrix displays. |
website | https://fietkau.software/minihat |
last change | Thu, 6 Oct 2022 22:18:31 +0000 (00:18 +0200) |
2022-10-06 | Julian Fietkau | Update readme to reflect previous commit main | commit | commitdiff | tree | snapshot |
2022-10-06 | Julian Fietkau | Add support for image loading | commit | commitdiff | tree | snapshot |
2022-10-06 | Julian Fietkau | Initial public release | commit | commitdiff | tree | snapshot |
A browser-based simulator of LED matrix displays.
The MiniHat functionality is modeled very closely after the Sense HAT API. It offers the functions flip_h, flip_v, set_pixels, get_pixels, set_pixel, get_pixel, load_image, and clear. There are stubs for show_message and show_letter, but they are not functional (no text font has been implemented). Everything else was out of scope for my needs. The parts that exist cover most of the pixel-based LED display manipulation with the exception of gamma adjustment.
Unlike the Sense HAT, which internally reduced the color channel value range, MiniHat supports the full 8-bit RGB color space. The demo above uses an 8×8 display to match the Sense HAT, but the library supports arbitrary LED display resolutions and arbitrary canvas pixel depths per LED (limited by the browser’s maximum canvas size). This is a client-side library intended to be used in web projects. It relies heavily on the canvas API. The LED glow is based on a black and white intensity stencil that is created dynamically for the requested pixel depth and used as a value-shifted visibility threshold. It is hand-tuned to result in small glowing dots for low intensity colors, full-size vibrant spots for medium intensity colors, and overglow plus white shift for high intensity colors.
A small demo is included. A more full-featured demo can be found on the project website: https://fietkau.software/minihat
(c) 2020–2022 Julian Fietkau, released under the MIT license.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.