diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2021-11-17 08:22:56 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-11-27 09:02:17 -0500 |
commit | fd50baa23ff5e17fad7d549ac226e8cf8dc67b86 (patch) | |
tree | 99d87e39ddb78c83a954258d494521e69cc44652 /apps/plugins | |
parent | e4d8431211eef3236a0030b49ed307ce6c048f6c (diff) | |
download | rockbox-fd50baa23ff5e17fad7d549ac226e8cf8dc67b86.tar.gz rockbox-fd50baa23ff5e17fad7d549ac226e8cf8dc67b86.zip |
PictureFlow: Reversible and interruptible animations
Makes PF usable on older devices with few FPS,
and makes it quicker to navigate on current devices.
- PF_BACK while zooming in to zoom out again
- PF_SELECT or PF_PREV/PF_NEXT while zooming in to skip animation
- PF_BACK while zooming out to skip animation
- PF_PREV/PF_NEXT while zooming out to skip animation + scroll
- PF_SELECT while zooming out to zoom in again
- PF_CONTEXT while zooming out to skip animation and append
- PF_CONTEXT while scrolling to append
- PF_SELECT while scrolling to zoom in
Change-Id: I8d041b53f5990181059fe837a8ca121ebf37a676
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 78 |
1 files changed, 74 insertions, 4 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 98ccba56f3..07403083f0 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -3295,6 +3295,47 @@ static void update_cover_out_animation(void) | |||
3295 | } | 3295 | } |
3296 | 3296 | ||
3297 | /** | 3297 | /** |
3298 | Skip steps for zooming into the current cover | ||
3299 | */ | ||
3300 | static void interrupt_cover_in_animation(void) | ||
3301 | { | ||
3302 | pf_state = pf_show_tracks; | ||
3303 | cover_animation_keyframe = 0; | ||
3304 | extra_fade = 13 * 19; | ||
3305 | center_slide.distance = -5 * 19; | ||
3306 | center_slide.angle = 19 + (15 * 16); | ||
3307 | } | ||
3308 | |||
3309 | /** | ||
3310 | Skip steps for zooming out the current cover | ||
3311 | */ | ||
3312 | static void interrupt_cover_out_animation(void) | ||
3313 | { | ||
3314 | pf_state = pf_idle; | ||
3315 | cover_animation_keyframe = 0; | ||
3316 | extra_fade = 0; | ||
3317 | set_current_slide(center_index); | ||
3318 | } | ||
3319 | |||
3320 | /** | ||
3321 | Stop zooming out the current cover and start zooming in | ||
3322 | */ | ||
3323 | static void revert_cover_out_animation(void) | ||
3324 | { | ||
3325 | pf_state = pf_cover_in; | ||
3326 | cover_animation_keyframe = 34 - cover_animation_keyframe; | ||
3327 | } | ||
3328 | |||
3329 | /** | ||
3330 | Stop zooming into the current cover and start zooming out | ||
3331 | */ | ||
3332 | static void revert_cover_in_animation(void) | ||
3333 | { | ||
3334 | pf_state = pf_cover_out; | ||
3335 | cover_animation_keyframe = 34 - cover_animation_keyframe; | ||
3336 | } | ||
3337 | |||
3338 | /** | ||
3298 | Draw a blue gradient at y with height h | 3339 | Draw a blue gradient at y with height h |
3299 | */ | 3340 | */ |
3300 | static inline void draw_gradient(int y, int h) | 3341 | static inline void draw_gradient(int y, int h) |
@@ -3817,7 +3858,11 @@ static int pictureflow_main(void) | |||
3817 | pf_state = pf_cover_out; | 3858 | pf_state = pf_cover_out; |
3818 | free_borrowed_tracks(); | 3859 | free_borrowed_tracks(); |
3819 | } | 3860 | } |
3820 | if (pf_state == pf_idle || pf_state == pf_scrolling) | 3861 | else if (pf_state == pf_cover_in) |
3862 | revert_cover_in_animation(); | ||
3863 | else if (pf_state == pf_cover_out) | ||
3864 | interrupt_cover_out_animation(); | ||
3865 | else if (pf_state == pf_idle || pf_state == pf_scrolling) | ||
3821 | return PLUGIN_OK; | 3866 | return PLUGIN_OK; |
3822 | break; | 3867 | break; |
3823 | case PF_MENU: | 3868 | case PF_MENU: |
@@ -3838,6 +3883,11 @@ static int pictureflow_main(void) | |||
3838 | case PF_NEXT_REPEAT: | 3883 | case PF_NEXT_REPEAT: |
3839 | if ( pf_state == pf_show_tracks ) | 3884 | if ( pf_state == pf_show_tracks ) |
3840 | select_next_track(); | 3885 | select_next_track(); |
3886 | else if (pf_state == pf_cover_in) | ||
3887 | interrupt_cover_in_animation(); | ||
3888 | else if (pf_state == pf_cover_out) | ||
3889 | interrupt_cover_out_animation(); | ||
3890 | |||
3841 | if ( pf_state == pf_idle || pf_state == pf_scrolling ) | 3891 | if ( pf_state == pf_idle || pf_state == pf_scrolling ) |
3842 | show_next_slide(); | 3892 | show_next_slide(); |
3843 | break; | 3893 | break; |
@@ -3846,13 +3896,27 @@ static int pictureflow_main(void) | |||
3846 | case PF_PREV_REPEAT: | 3896 | case PF_PREV_REPEAT: |
3847 | if ( pf_state == pf_show_tracks ) | 3897 | if ( pf_state == pf_show_tracks ) |
3848 | select_prev_track(); | 3898 | select_prev_track(); |
3899 | else if (pf_state == pf_cover_in) | ||
3900 | interrupt_cover_in_animation(); | ||
3901 | else if (pf_state == pf_cover_out) | ||
3902 | interrupt_cover_out_animation(); | ||
3903 | |||
3849 | if ( pf_state == pf_idle || pf_state == pf_scrolling ) | 3904 | if ( pf_state == pf_idle || pf_state == pf_scrolling ) |
3850 | show_previous_slide(); | 3905 | show_previous_slide(); |
3851 | break; | 3906 | break; |
3852 | #if PF_PLAYBACK_CAPABLE | 3907 | #if PF_PLAYBACK_CAPABLE |
3853 | case PF_CONTEXT: | 3908 | case PF_CONTEXT: |
3854 | if ( pf_cfg.auto_wps != 0 && | 3909 | if (pf_cfg.auto_wps != 0 && |
3855 | (pf_state == pf_idle || pf_state == pf_show_tracks)) { | 3910 | (pf_state == pf_idle || pf_state == pf_scrolling || |
3911 | pf_state == pf_show_tracks || pf_state == pf_cover_out)) { | ||
3912 | |||
3913 | if ( pf_state == pf_scrolling) | ||
3914 | { | ||
3915 | set_current_slide(target); | ||
3916 | pf_state = pf_idle; | ||
3917 | } else if (pf_state == pf_cover_out) | ||
3918 | interrupt_cover_out_animation(); | ||
3919 | |||
3856 | if( pf_state == pf_idle ) { | 3920 | if( pf_state == pf_idle ) { |
3857 | create_track_index(center_slide.slide_index); | 3921 | create_track_index(center_slide.slide_index); |
3858 | reset_track_list(); | 3922 | reset_track_list(); |
@@ -3887,7 +3951,9 @@ static int pictureflow_main(void) | |||
3887 | break; | 3951 | break; |
3888 | } | 3952 | } |
3889 | case PF_SELECT: | 3953 | case PF_SELECT: |
3890 | if ( pf_state == pf_idle ) { | 3954 | if ( pf_state == pf_idle || pf_state == pf_scrolling) { |
3955 | if (pf_state == pf_scrolling) | ||
3956 | set_current_slide(target); | ||
3891 | #if PF_PLAYBACK_CAPABLE | 3957 | #if PF_PLAYBACK_CAPABLE |
3892 | if(pf_cfg.auto_wps == 1) { | 3958 | if(pf_cfg.auto_wps == 1) { |
3893 | create_track_index(center_slide.slide_index); | 3959 | create_track_index(center_slide.slide_index); |
@@ -3900,6 +3966,10 @@ static int pictureflow_main(void) | |||
3900 | #endif | 3966 | #endif |
3901 | pf_state = pf_cover_in; | 3967 | pf_state = pf_cover_in; |
3902 | } | 3968 | } |
3969 | else if (pf_state == pf_cover_out) | ||
3970 | revert_cover_out_animation(); | ||
3971 | else if (pf_state == pf_cover_in) | ||
3972 | interrupt_cover_in_animation(); | ||
3903 | else if ( pf_state == pf_show_tracks ) { | 3973 | else if ( pf_state == pf_show_tracks ) { |
3904 | #if PF_PLAYBACK_CAPABLE | 3974 | #if PF_PLAYBACK_CAPABLE |
3905 | start_playback(false); | 3975 | start_playback(false); |