I might have found a starting point for some of the animations. Only problem is, it is for Neopixel Library. I have tried to convert it to FastLed but it won´t work. Maybe because of the way the fading is written. Probably fadeToBlackBy could be used here?!
Neopixel Code:
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
int brightness = 50;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(20, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.setBrightness(brightness);
strip.show();
}
void loop() {
chaser(255, 0, 0, 1, 3, 5, 80);
}
void chaser(int r, int g, int b, int rounds, int width, int fade, int wait) {
int faktor = 20 / (fade * 2);
int r2, g2, b2;
for (int i = 0; i < strip.numPixels() + width + fade; i++) {
for (int j = 0; j < width; j++) {
strip.setPixelColor(i - j, r, g, b);
for (int f = fade; f > 0; f--) {
r2 = (r / 20) * (f * faktor);
g2 = (g / 20) * (f * faktor);
b2 = (b / 20) * (f * faktor);
strip.setPixelColor((i - width - fade + f), r2, g2, b2);
}
strip.setPixelColor(i - width - fade, 0, 0, 0);
}
strip.show();
delay(wait);
}
for (int i = strip.numPixels(); i > 0 - width - fade - 2; i--) {
for (int j = width; j > 0; j--) {
strip.setPixelColor(i + j, r, g, b);
for (int f = fade; f > 0; f--) {
r2 = (r / 20) * (f * faktor);
g2 = (g / 20) * (f * faktor);
b2 = (b / 20) * (f * faktor);
strip.setPixelColor((i + width + fade - f + 1), r2, g2, b2);
}
strip.setPixelColor(i + width + fade + 1, 0, 0, 0);
}
strip.show();
delay(wait);
}
}
My attempt of converting the code to fastLED (not working):
#include "FastLED.h"
#define NUM_LEDS 20
#define PIN 6
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2811, PIN, GRB>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(50);
}
void loop() {
chaser(0, 255, 0, 1, 3, 5, 80);
}
void chaser(int r, int g, int b, int rounds, int width, int fade, int wait) {
int faktor = 20 / (fade * 2);
int r2, g2, b2;
for (int i = 0; i < NUM_LEDS + width + fade; i++) {
for (int j = 0; j < width; j++) {
leds[i - j] = CRGB(r, g, b);
for (int f = fade; f > 0; f--) {
r2 = (r / 20) * (f * faktor);
g2 = (g / 20) * (f * faktor);
b2 = (b / 20) * (f * faktor);
leds[i - width - fade + f] = CRGB(r2, g2, b2);
}
leds[i - width - fade] = CRGB::Black;
}
FastLED.show();
delay(wait);
}
for (int i = NUM_LEDS; i > 0 - width - fade - 2; i--) {
for (int j = width; j > 0; j--) {
leds[i + j] = CRGB(r, g, b);
for (int f = fade; f > 0; f--) {
r2 = (r / 20) * (f * faktor);
g2 = (g / 20) * (f * faktor);
b2 = (b / 20) * (f * faktor);
leds[i + width + fade - f + 1] = CRGB(r2, g2, b2);
}
leds[i + width + fade + 1] = CRGB::Black;
}
FastLED.show();
delay(wait);
}
}