TinyCircuits Forum

General Category => General Discussion => Topic started by: beermat on February 28, 2017, 12:31:24 AM

Title: TinyScreen+ fireworks
Post by: beermat on February 28, 2017, 12:31:24 AM
Quick sketch I've been working on, playing with various features of TinyScreen+ and exploring performance potential of the product. This sketch draws firework-like particles on the TinyScreen+, utilizing some fast (approximate) sin and cos libraries from FastLED, a fast memcpy function from Daniel Vik, and double full screen buffers, transmitted to the screen via DMA buffer transfer in TinyScreen.cpp. Trails are created by dimming previous pixels in the buffer. Some comments in the sketch should guide you to play around and change parameters or create new animations. Code readability sacrificed for performance, but the basic principle of the particle motion is:

x=cos(angle) * velocity * time
y=sin(angle) * velocity * time + (gravity * time2)/2

Video here: https://www.youtube.com/watch?v=yx1q0dLf7og
Code here: https://github.com/egonbeermat/fireworks
FastLED library here: https://github.com/FastLED/FastLED/releases