Thomas Kolb
25abc446b0
This massively improves glitches in functions like sin(t + sin(t)), as used in the RgbwPsychedelicAnimation. That animation is now almost flicker-free.
38 lines
865 B
C++
38 lines
865 B
C++
#pragma once
|
|
|
|
#include <array>
|
|
|
|
#include "Animation.h"
|
|
|
|
#include "fasttrigon.h"
|
|
|
|
class RgbwSinusAnimation : public Animation
|
|
{
|
|
public:
|
|
typedef std::array<uint32_t, 4> rgbw_val_array;
|
|
RgbwSinusAnimation(Fader *fader,
|
|
const rgbw_val_array &speeds = {2273, 2281, 2287, 2293},
|
|
uint32_t speed_divider = 1024,
|
|
uint16_t brightness_scale = fasttrigon::SCALE/4); // max: 255
|
|
|
|
void loop(uint64_t frame) override;
|
|
|
|
void stop(void) override
|
|
{
|
|
m_stopping = true;
|
|
}
|
|
|
|
void reset(void) override;
|
|
|
|
private:
|
|
bool m_stopping;
|
|
|
|
rgbw_val_array m_speeds;
|
|
uint32_t m_speedDivider;
|
|
uint16_t m_brightnessScale;
|
|
|
|
rgbw_val_array m_phi;
|
|
|
|
uint32_t m_overflowInterval;
|
|
};
|