#include "fasttrigon.h" #include "Animation/ConnectingAnimation.h" ConnectingAnimation::ConnectingAnimation(Fader *fader) : Animation(fader), m_stopping(false) {} void ConnectingAnimation::loop(uint64_t frame) { std::size_t nstrip = m_fader->strips(); uint8_t intensity = 0; if(frame == 0) { m_fader->fade_color(Fader::Color{0, 0, 0, 0}); } for(std::size_t strip = 0; strip < nstrip; strip++) { intensity = (FASTTRIGON_8BIT(fasttrigon::fastsin(1 * frame * fasttrigon::LUT_SIZE / 60 + fasttrigon::LUT_SIZE*3/4)) + 127) / 4; Fader::Color c; c.b = intensity; m_fader->set_color(strip, 0, c); } // stop the animation at maximum level for smooth transition to ConnectionEstablishedAnimation if(m_stopping && intensity == 63) { m_running = false; } }