aboutsummaryrefslogtreecommitdiffstats
path: root/visualizer.c
diff options
context:
space:
mode:
authorGravatar Fred Sundvik <fsundvik@gmail.com>2016-04-24 16:19:31 +0300
committerGravatar Fred Sundvik <fsundvik@gmail.com>2016-04-24 16:19:31 +0300
commit891edbd533acdffec66416c59f4b6066e5e18aaa (patch)
treee88c14219a4b83148f78d047ced1d6d631644169 /visualizer.c
parent444132edd056cd52a60e3551d1f6c1a07909c040 (diff)
downloadqmk_firmware-891edbd533acdffec66416c59f4b6066e5e18aaa.tar.gz
Add function for running the next keyframe
Diffstat (limited to 'visualizer.c')
-rw-r--r--visualizer.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/visualizer.c b/visualizer.c
index 219d44cd3..2ec6e34f5 100644
--- a/visualizer.c
+++ b/visualizer.c
@@ -178,6 +178,21 @@ static bool update_keyframe_animation(keyframe_animation_t* animation, visualize
return true;
}
+void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state) {
+ int next_frame = animation->current_frame + 1;
+ if (next_frame == animation->num_frames) {
+ next_frame = 0;
+ }
+ keyframe_animation_t temp_animation = *animation;
+ temp_animation.current_frame = next_frame;
+ temp_animation.time_left_in_frame = animation->frame_lengths[next_frame];
+ temp_animation.first_update_of_frame = true;
+ temp_animation.last_update_of_frame = false;
+ temp_animation.need_update = false;
+ visualizer_state_t temp_state = *state;
+ (*temp_animation.frame_functions[next_frame])(&temp_animation, &temp_state);
+}
+
bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;