2021-04-08 13:07:48 +02:00
|
|
|
#include "../../lv_examples.h"
|
2021-02-14 14:56:34 +01:00
|
|
|
|
|
|
|
#if LV_USE_ARC && LV_BUILD_EXAMPLES
|
2021-02-08 09:53:03 +01:00
|
|
|
|
2021-05-07 13:33:53 +02:00
|
|
|
static void set_angle(void * obj, int32_t v)
|
2021-02-08 09:53:03 +01:00
|
|
|
{
|
2021-05-07 13:33:53 +02:00
|
|
|
lv_arc_set_value(obj, v);
|
2021-02-08 09:53:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an arc which acts as a loader.
|
|
|
|
*/
|
|
|
|
void lv_example_arc_2(void)
|
|
|
|
{
|
2022-02-13 13:59:17 -05:00
|
|
|
/*Create an Arc*/
|
2023-10-12 20:37:27 +02:00
|
|
|
lv_obj_t * arc = lv_arc_create(lv_screen_active());
|
2022-02-13 13:59:17 -05:00
|
|
|
lv_arc_set_rotation(arc, 270);
|
|
|
|
lv_arc_set_bg_angles(arc, 0, 360);
|
|
|
|
lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
|
2023-10-12 20:37:27 +02:00
|
|
|
lv_obj_remove_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
|
2022-02-13 13:59:17 -05:00
|
|
|
lv_obj_center(arc);
|
|
|
|
|
|
|
|
lv_anim_t a;
|
|
|
|
lv_anim_init(&a);
|
|
|
|
lv_anim_set_var(&a, arc);
|
|
|
|
lv_anim_set_exec_cb(&a, set_angle);
|
|
|
|
lv_anim_set_time(&a, 1000);
|
|
|
|
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); /*Just for the demo*/
|
|
|
|
lv_anim_set_repeat_delay(&a, 500);
|
|
|
|
lv_anim_set_values(&a, 0, 100);
|
|
|
|
lv_anim_start(&a);
|
2021-05-07 13:33:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-08 09:53:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|