esp32-sk6812/include/Animation/StellarAnimation.h

36 lines
835 B
C++

#pragma once
#include <random>
#include <list>
#include "Animation.h"
class StellarAnimation : public Animation
{
public:
StellarAnimation(Fader *fader,
const Fader::Color &background_color = Fader::Color{0x00, 0x02, 0x0c, 0x00},
const Fader::Color &star_color = Fader::Color{0x60, 0x30, 0x00, 0x60},
int fadestep = 1, int spawn_interval_frames = 12);
void loop(uint64_t frame) override;
void stop(void) override
{
m_stopping = true;
}
void reset(void) override;
private:
std::default_random_engine m_gen;
Fader::Color m_backgroundColor;
Fader::Color m_starColor;
int m_fadestep;
int m_spawnInterval; // in frames
bool m_stopping;
};