|
|
@ -89,14 +89,11 @@ static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS];
|
|
|
|
static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS];
|
|
|
|
static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS];
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t compute_gradient_color(float t, float index, float num) {
|
|
|
|
static uint8_t compute_gradient_color(float t, float index, float num) {
|
|
|
|
const float target = t * (num - 1.0f);
|
|
|
|
const float two_pi = 2.0f * PI;
|
|
|
|
const float half_num = num / 2.0f;
|
|
|
|
float normalized_index = (1.0f - index / (num - 1)) * two_pi;
|
|
|
|
float d = fabs(index - target);
|
|
|
|
float x = t * two_pi + normalized_index;
|
|
|
|
if (d > half_num) {
|
|
|
|
float v = 0.5 * (cosf(x) + 1.0f);
|
|
|
|
d = num - d;
|
|
|
|
return (uint8_t)(255.0f * v);
|
|
|
|
}
|
|
|
|
|
|
|
|
d = 1.0f - (d / half_num);
|
|
|
|
|
|
|
|
return (uint8_t)(255.0f * d);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool keyframe_fade_in_all_leds(keyframe_animation_t* animation, visualizer_state_t* state) {
|
|
|
|
bool keyframe_fade_in_all_leds(keyframe_animation_t* animation, visualizer_state_t* state) {
|
|
|
|