init Files
This commit is contained in:
42
libraries/lvgl/examples/widgets/image/lv_example_image_3.c
Normal file
42
libraries/lvgl/examples/widgets/image/lv_example_image_3.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_IMAGE && LV_BUILD_EXAMPLES
|
||||
|
||||
static void set_angle(void * img, int32_t v)
|
||||
{
|
||||
lv_image_set_rotation(img, v);
|
||||
}
|
||||
|
||||
static void set_scale(void * img, int32_t v)
|
||||
{
|
||||
lv_image_set_scale(img, v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show transformations (zoom and rotation) using a pivot point.
|
||||
*/
|
||||
void lv_example_image_3(void)
|
||||
{
|
||||
LV_IMAGE_DECLARE(img_cogwheel_argb);
|
||||
|
||||
/*Now create the actual image*/
|
||||
lv_obj_t * img = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(img, &img_cogwheel_argb);
|
||||
lv_obj_align(img, LV_ALIGN_CENTER, 50, 50);
|
||||
lv_image_set_pivot(img, 0, 0); /*Rotate around the top left corner*/
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, img);
|
||||
lv_anim_set_exec_cb(&a, set_angle);
|
||||
lv_anim_set_values(&a, 0, 3600);
|
||||
lv_anim_set_duration(&a, 5000);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
lv_anim_set_exec_cb(&a, set_scale);
|
||||
lv_anim_set_values(&a, 128, 256);
|
||||
lv_anim_set_playback_duration(&a, 3000);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user