animations.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright 2017 Fred Sundvik
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #if defined(VISUALIZER_ENABLE)
  17. #include "animations.h"
  18. #include "visualizer.h"
  19. #ifdef LCD_ENABLE
  20. #include "lcd_keyframes.h"
  21. #endif
  22. #ifdef LCD_BACKLIGHT_ENABLE
  23. #include "lcd_backlight_keyframes.h"
  24. #endif
  25. #ifdef LED_ENABLE
  26. #include "led_keyframes.h"
  27. #endif
  28. #include "visualizer_keyframes.h"
  29. #if defined(LCD_ENABLE) && defined(LCD_BACKLIGHT_ENABLE)
  30. // Don't worry, if the startup animation is long, you can use the keyboard like normal
  31. // during that time
  32. keyframe_animation_t default_startup_animation = {
  33. .num_frames = 4,
  34. .loop = false,
  35. .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(5000), 0},
  36. .frame_functions = {
  37. lcd_keyframe_enable,
  38. backlight_keyframe_enable,
  39. lcd_keyframe_draw_logo,
  40. backlight_keyframe_animate_color,
  41. },
  42. };
  43. keyframe_animation_t default_suspend_animation = {
  44. .num_frames = 4,
  45. .loop = false,
  46. .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0},
  47. .frame_functions = {
  48. lcd_keyframe_display_layer_text,
  49. backlight_keyframe_animate_color,
  50. lcd_keyframe_disable,
  51. backlight_keyframe_disable,
  52. },
  53. };
  54. #endif
  55. #if defined(LED_ENABLE)
  56. #define CROSSFADE_TIME 1000
  57. #define GRADIENT_TIME 3000
  58. keyframe_animation_t led_test_animation = {
  59. .num_frames = 14,
  60. .loop = true,
  61. .frame_lengths = {
  62. gfxMillisecondsToTicks(1000), // fade in
  63. gfxMillisecondsToTicks(1000), // no op (leds on)
  64. gfxMillisecondsToTicks(1000), // fade out
  65. gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
  66. gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in)
  67. gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
  68. gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
  69. 0, // mirror leds
  70. gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
  71. gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out)
  72. gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
  73. gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
  74. 0, // normal leds
  75. gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
  76. },
  77. .frame_functions = {
  78. led_keyframe_fade_in_all,
  79. keyframe_no_operation,
  80. led_keyframe_fade_out_all,
  81. led_keyframe_crossfade,
  82. led_keyframe_left_to_right_gradient,
  83. led_keyframe_crossfade,
  84. led_keyframe_top_to_bottom_gradient,
  85. led_keyframe_mirror_orientation,
  86. led_keyframe_crossfade,
  87. led_keyframe_left_to_right_gradient,
  88. led_keyframe_crossfade,
  89. led_keyframe_top_to_bottom_gradient,
  90. led_keyframe_normal_orientation,
  91. led_keyframe_crossfade,
  92. },
  93. };
  94. #endif
  95. #endif