esp32-sk6812/include/Animation/ChristmasGlitterAnimation.h

37 lines
936 B
C++

#pragma once
#include <random>
#include <list>
#include "Animation.h"
class ChristmasGlitterAnimation : public Animation
{
public:
ChristmasGlitterAnimation(Fader *fader,
const Fader::Color &background_color = Fader::Color{0x06, 0x04, 0x00, 0x04},
const Fader::Color &glitter_color = Fader::Color{0x60, 0x40, 0x00, 0x60},
int fadestep = 1, int background_spawns_per_frame = 20, int spawn_interval_frames = 4);
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_glitterColor;
int m_fadestep;
int m_spawnInterval; // in frames
int m_backgroundSpawnsPerFrame;
bool m_stopping;
};