1 #include "../../lv_examples.h"
2 #if LV_USE_IMAGE && LV_BUILD_EXAMPLES
3 
set_angle(void * img,int32_t v)4 static void set_angle(void * img, int32_t v)
5 {
6     lv_image_set_rotation(img, v);
7 }
8 
set_scale(void * img,int32_t v)9 static void set_scale(void * img, int32_t v)
10 {
11     lv_image_set_scale(img, v);
12 }
13 
14 /**
15  * Show transformations (zoom and rotation) using a pivot point.
16  */
lv_example_image_3(void)17 void lv_example_image_3(void)
18 {
19     LV_IMAGE_DECLARE(img_cogwheel_argb);
20 
21     /*Now create the actual image*/
22     lv_obj_t * img = lv_image_create(lv_screen_active());
23     lv_image_set_src(img, &img_cogwheel_argb);
24     lv_obj_align(img, LV_ALIGN_CENTER, 50, 50);
25     lv_image_set_pivot(img, 0, 0);    /*Rotate around the top left corner*/
26 
27     lv_anim_t a;
28     lv_anim_init(&a);
29     lv_anim_set_var(&a, img);
30     lv_anim_set_exec_cb(&a, set_angle);
31     lv_anim_set_values(&a, 0, 3600);
32     lv_anim_set_duration(&a, 5000);
33     lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
34     lv_anim_start(&a);
35 
36     lv_anim_set_exec_cb(&a, set_scale);
37     lv_anim_set_values(&a, 128, 256);
38     lv_anim_set_reverse_duration(&a, 3000);
39     lv_anim_start(&a);
40 }
41 
42 #endif
43