Thomas Kolb
75c17f28f8
It’s an extension to the previous RgbwSinusAnimation and tilts and moves the sine waves differently for each color band. Additive color mixing generates very interesting patterns.
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
|
|
#include "Animation.h"
|
|
|
|
#include "fasttrigon.h"
|
|
|
|
class RgbwPsychedelicAnimation : public Animation
|
|
{
|
|
public:
|
|
typedef std::array<int32_t, 4> rgbw_val_array;
|
|
RgbwPsychedelicAnimation(Fader *fader,
|
|
const rgbw_val_array &move_speeds = {2273, 2281, 2287, 2293},
|
|
const rgbw_val_array &tilt_speeds = {2297, 2309, 2311, 2333},
|
|
int32_t tilt_maxperiods = 3,
|
|
uint32_t move_speed_divider = 1024,
|
|
uint32_t tilt_speed_divider = 8192,
|
|
uint16_t brightness_scale = 64); // 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_move_speeds;
|
|
rgbw_val_array m_tilt_speeds;
|
|
uint32_t m_moveSpeedDivider;
|
|
uint32_t m_tiltSpeedDivider;
|
|
uint16_t m_brightnessScale;
|
|
|
|
int32_t m_tilt_maxperiods;
|
|
|
|
rgbw_val_array m_move_phi;
|
|
rgbw_val_array m_tilt_phi;
|
|
|
|
int32_t m_moveOverflowInterval;
|
|
int32_t m_tiltOverflowInterval;
|
|
};
|