当前位置:网站首页>Lvgl 8.2 picture scaling and rotation
Lvgl 8.2 picture scaling and rotation
2022-06-30 10:54:00 【Fairy sword love】
The animation callback function sets the angle
static void set_angle(void* img, int32_t v)
{
lv_img_set_angle(img, v);
}
The animation callback function sets the zoom size
static void set_zoom(void* img, int32_t v)
{
lv_img_set_zoom(img, v);
}
establish Image And zoom , Rotate the picture
/** * Show transformations (zoom and rotation) using a pivot point. */
static void lv_example_img_3(void)
{
LV_IMG_DECLARE(img_cogwheel_argb); // Picture resource statement
/*Now create the actual image*/
lv_obj_t* img = lv_img_create(lv_scr_act()); // establish Image object
lv_img_set_src(img, &img_cogwheel_argb); // Set the displayed picture source
lv_obj_align(img, LV_ALIGN_CENTER, 50, 50); // Center offset 50,50 Align at
lv_img_set_pivot(img, 0, 0); // around Image Rotate the upper left corner of the object
lv_anim_t a;
lv_anim_init(&a); // Initializing animation variables
lv_anim_set_var(&a, img); // Animate the associated objects img
lv_anim_set_exec_cb(&a, set_angle); // Set the callback function for animation execution set_angle
lv_anim_set_values(&a, 0, 3600); // Set the range of animation , Here is the angle 0~360 degree
lv_anim_set_time(&a, 5000); // Animate duration Time 5000 millisecond
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);// Set the number of animation repetitions , Here is infinite times
lv_anim_start(&a); // Start animation playback
lv_anim_set_exec_cb(&a, set_zoom); // Set the animation to execute the callback function set_zoom
lv_anim_set_values(&a, 128, 256); // Set the range of animation , Here is the zoom ratio 128~256
lv_anim_set_playback_time(&a, 3000); // Set the animation replay time 3000 millisecond
lv_anim_start(&a); // Start animation playback
}
Running effect

边栏推荐
- LeetCode Algorithm 86. 分隔链表
- 腾讯云数据库工程师能力认证重磅推出,各界共话人才培养难题
- [STL source code analysis] container (to be supplemented)
- 吴恩达2022机器学习专项课测评来了!
- Sarsa笔记
- 深潜Kotlin协程(十七):演员
- Pandora IOT development board learning (HAL Library) - Experiment 1 running lantern (RGB) experiment (learning notes)
- 在IPhone12的推理延迟仅为1.6 ms!Snap等详析Transformer结构延迟,并用NAS搜出移动设备的高效网络结构...
- When does the database need to use the index [Hangzhou multi surveyors] [Hangzhou multi surveyors _ Wang Sir]
- China will force a unified charging interface. If Apple does not bow its head, iPhone will be kicked out of the Chinese market
猜你喜欢

The intelligent DNA molecular nano robot model is coming

List介绍

数学知识复习:第二型曲线积分

深潜Kotlin协程(十八):冷热数据流

Overview of currency

ArcGIS PRO + PS vectorized land use planning map

Matplotlib notes: contour & Contour

China will force a unified charging interface. If Apple does not bow its head, iPhone will be kicked out of the Chinese market

What is erdma as illustrated by Coptic cartoon?

The two e-commerce bigwigs' lacy news screens represent the return of e-commerce to normal, which will be beneficial to the real economy
随机推荐
Use keil5 software to simulate and debug gd32f305 from 0
Pytorch Notebook. Nn. Batchnorm1d
The number of users of the home-made self-developed system exceeded 400million, breaking the monopoly of American enterprises, and Google repented
Kernel linked list (general linked list) "list.h" simple version and individual comments
LeetCode Algorithm 86. 分隔链表
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
The two e-commerce bigwigs' lacy news screens represent the return of e-commerce to normal, which will be beneficial to the real economy
Retest the cloud native database performance: polardb is still the strongest, while tdsql-c and gaussdb have little change
About Library (function library), dynamic library and static library
Voir le changement technologique à travers la Légion Huawei (5): Smart Park
软件测试工程师面试基础题(应届生和测试小菜必备)最基础的面试题
蚂蚁金服笔试题:需求文档有什么可以量化的【杭州多测师】【杭州多测师_王sir】...
国产自研系统的用户突破4亿,打破美国企业的垄断,谷歌后悔不迭
pytorch 笔记:validation ,model.eval V.S torch.no_grad
What is erdma as illustrated by Coptic cartoon?
05_ Node JS file management module FS
Overview of currency
Mysql database foundation: constraint and identification columns
Skill combing [email protected] voice module +stm32+nfc
科普达人丨漫画图解什么是eRDMA?