1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** GUIX Component */ 17 /** */ 18 /** Animation Management (Animation) */ 19 /** */ 20 /**************************************************************************/ 21 22 #define GX_SOURCE_CODE 23 24 25 /* Include necessary system files. */ 26 27 #include "gx_api.h" 28 #include "gx_widget.h" 29 #include "gx_system.h" 30 #include "gx_animation.h" 31 #include "gx_utility.h" 32 33 /**************************************************************************/ 34 /* */ 35 /* FUNCTION RELEASE */ 36 /* */ 37 /* _gx_animation_slide_landing_start PORTABLE C */ 38 /* 6.1.11 */ 39 /* AUTHOR */ 40 /* */ 41 /* Kenneth Maxwell, Microsoft Corporation */ 42 /* */ 43 /* DESCRIPTION */ 44 /* */ 45 /* This function starts a timer to move the sliding screens to the */ 46 /* target position step by step. */ 47 /* */ 48 /* INPUT */ 49 /* */ 50 /* animation Pointer to animation control */ 51 /* block */ 52 /* */ 53 /* OUTPUT */ 54 /* */ 55 /* status Completion status */ 56 /* */ 57 /* CALLS */ 58 /* */ 59 /* _gx_system_timer_start Start a timer for a widget */ 60 /* */ 61 /* CALLED BY */ 62 /* */ 63 /* Application Code */ 64 /* */ 65 /* RELEASE HISTORY */ 66 /* */ 67 /* DATE NAME DESCRIPTION */ 68 /* */ 69 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 70 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 71 /* resulting in version 6.1 */ 72 /* 04-25-2022 Ting Zhu Modified comment(s), */ 73 /* added canvas support, */ 74 /* resulting in version 6.1.11 */ 75 /* */ 76 /**************************************************************************/ _gx_animation_slide_landing_start(GX_ANIMATION * animation)77UINT _gx_animation_slide_landing_start(GX_ANIMATION *animation) 78 { 79 GX_ANIMATION_INFO *info; 80 GX_WIDGET *target; 81 GX_RECTANGLE *target_size; 82 83 if ((animation -> gx_animation_slide_target_index_1 >= 0) && 84 (animation -> gx_animation_status == GX_ANIMATION_IDLE)) 85 { 86 info = &animation -> gx_animation_info; 87 88 if (animation -> gx_animation_slide_target_index_2 >= 0) 89 { 90 target = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_2]; 91 } 92 else 93 { 94 target = info -> gx_animation_slide_screen_list[animation -> gx_animation_slide_target_index_1]; 95 } 96 97 target_size = &target -> gx_widget_size; 98 99 if (animation -> gx_animation_canvas) 100 { 101 info -> gx_animation_start_position.gx_point_x = (GX_VALUE)(target_size -> gx_rectangle_left + animation -> gx_animation_canvas -> gx_canvas_display_offset_x); 102 info -> gx_animation_start_position.gx_point_y = (GX_VALUE)(target_size -> gx_rectangle_top + animation -> gx_animation_canvas -> gx_canvas_display_offset_y); 103 } 104 else 105 { 106 info -> gx_animation_start_position.gx_point_x = target_size -> gx_rectangle_left; 107 info -> gx_animation_start_position.gx_point_y = target_size -> gx_rectangle_top; 108 } 109 110 /* Start a landing timer. */ 111 _gx_system_timer_start(info -> gx_animation_parent, GX_ANIMATION_SLIDE_TIMER, 112 info -> gx_animation_frame_interval, 113 info -> gx_animation_frame_interval); 114 115 /* Set animation status. */ 116 animation -> gx_animation_status = GX_ANIMATION_SLIDE_LANDING; 117 info -> gx_animation_steps = animation -> gx_animation_total_steps; 118 } 119 120 /* Return completion status code. */ 121 return(GX_SUCCESS); 122 } 123 124