1 #include "../../lv_examples.h" 2 #if LV_BUILD_EXAMPLES 3 #if LV_DRAW_TRANSFORM_USE_MATRIX 4 timer_cb(lv_timer_t * timer)5static void timer_cb(lv_timer_t * timer) 6 { 7 lv_obj_t * obj = lv_timer_get_user_data(timer); 8 9 static float value = 0.1f; 10 lv_matrix_t matrix; 11 lv_matrix_identity(&matrix); 12 lv_matrix_scale(&matrix, value, 1); 13 lv_matrix_rotate(&matrix, value * 360); 14 lv_obj_set_transform(obj, &matrix); 15 16 value += 0.01f; 17 18 if(value > 2.0f) { 19 lv_obj_reset_transform(obj); 20 value = 0.1f; 21 } 22 } 23 lv_example_obj_3(void)24void lv_example_obj_3(void) 25 { 26 lv_obj_t * obj = lv_obj_create(lv_screen_active()); 27 lv_obj_center(obj); 28 29 lv_timer_create(timer_cb, 20, obj); 30 } 31 32 #else 33 lv_example_obj_3(void)34void lv_example_obj_3(void) 35 { 36 lv_obj_t * label = lv_label_create(lv_screen_active()); 37 lv_label_set_text_static(label, "LV_DRAW_TRANSFORM_USE_MATRIX is not enabled"); 38 lv_obj_center(label); 39 } 40 41 #endif /*LV_DRAW_TRANSFORM_USE_MATRIX*/ 42 #endif /*LV_BUILD_EXAMPLES*/ 43