esp32-sk6812/src/Animation/FadeToColorAnimation.cpp

20 lines
444 B
C++

#include "Animation/FadeToColorAnimation.h"
FadeToColorAnimation::FadeToColorAnimation(Fader *fader, const Fader::Color &color)
: Animation(fader), m_color(color), m_stopping(false)
{}
void FadeToColorAnimation::loop(uint64_t frame)
{
if(frame == 0) {
m_fader->set_fadestep(1);
m_fader->fade_color(m_color);
}
m_fader->update();
if(m_stopping) {
m_running = m_fader->something_changed();
}
}