1 #include "../../lv_examples.h"
2
3 #if LV_USE_ARC && LV_BUILD_EXAMPLES
4
set_angle(void * obj,int32_t v)5 static void set_angle(void * obj, int32_t v)
6 {
7 lv_arc_set_value(obj, v);
8 }
9
10 /**
11 * Create an arc which acts as a loader.
12 */
lv_example_arc_2(void)13 void lv_example_arc_2(void)
14 {
15 /*Create an Arc*/
16 lv_obj_t * arc = lv_arc_create(lv_scr_act());
17 lv_arc_set_rotation(arc, 270);
18 lv_arc_set_bg_angles(arc, 0, 360);
19 lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
20 lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
21 lv_obj_center(arc);
22
23 lv_anim_t a;
24 lv_anim_init(&a);
25 lv_anim_set_var(&a, arc);
26 lv_anim_set_exec_cb(&a, set_angle);
27 lv_anim_set_time(&a, 1000);
28 lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); /*Just for the demo*/
29 lv_anim_set_repeat_delay(&a, 500);
30 lv_anim_set_values(&a, 0, 100);
31 lv_anim_start(&a);
32
33 }
34
35 #endif
36