当前位置:网站首页>LVGL 8.2图片缩放及旋转
LVGL 8.2图片缩放及旋转
2022-06-30 10:08:00 【仙剑情缘】
动画回调函数设置角度
static void set_angle(void* img, int32_t v)
{
lv_img_set_angle(img, v);
}
动画回调函数设置缩放大小
static void set_zoom(void* img, int32_t v)
{
lv_img_set_zoom(img, v);
}
创建Image及缩放,旋转图片
/** * Show transformations (zoom and rotation) using a pivot point. */
static void lv_example_img_3(void)
{
LV_IMG_DECLARE(img_cogwheel_argb); // 图片资源声明
/*Now create the actual image*/
lv_obj_t* img = lv_img_create(lv_scr_act()); // 创建Image对象
lv_img_set_src(img, &img_cogwheel_argb); //设置显示的图片源
lv_obj_align(img, LV_ALIGN_CENTER, 50, 50); // 居中偏移50,50处对齐
lv_img_set_pivot(img, 0, 0); // 围绕Image对象左上角旋转
lv_anim_t a;
lv_anim_init(&a); // 初时化动画变量
lv_anim_set_var(&a, img); //设置动画关联的对象img
lv_anim_set_exec_cb(&a, set_angle); //设置动画执行的回调函数set_angle
lv_anim_set_values(&a, 0, 3600); // 设置动画的范围,这里是角度0~360度
lv_anim_set_time(&a, 5000); //设置动画duration时间5000毫秒
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);//设置动画重复次数,这里是无穷次
lv_anim_start(&a); //启动动画播放
lv_anim_set_exec_cb(&a, set_zoom); //设置动画执行回调函数set_zoom
lv_anim_set_values(&a, 128, 256); // 设置动画的范围,这里是缩放比例128~256
lv_anim_set_playback_time(&a, 3000); // 设置动画回播时间3000毫秒
lv_anim_start(&a); //启动动画播放
}
运行效果

边栏推荐
- 05_Node js 文件管理模块 fs
- RobotFramework学习笔记:环境安装以及robotframework-browser插件的安装
- Anhui "requirements for design depth of Hefei fabricated building construction drawing review" was printed and distributed; Hebei Hengshui city adjusts the pre-sale license standard for prefabricated
- 技能梳理[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled
- About Library (function library), dynamic library and static library
- 【深度学习】深度学习检测小目标常用方法
- 潘多拉 IOT 开发板学习(HAL 库)—— 实验1 跑马灯(RGB)实验(学习笔记)
- Musk has more than 100 million twitter fans, but he has been lost online for a week
- 技能梳理[email protected]体感机械臂
- Robotframework learning notes: environment installation and robotframework browser plug-in installation
猜你喜欢

sCrypt 中的 ECDSA 签名验证

Auto SEG loss: automatic loss function design

ArcGIS Pro + PS 矢量化用地规划图

Sarsa笔记

机器学习面试准备(一)KNN
[email protected] somatosensory manipulator"/>Skill combing [email protected] somatosensory manipulator
[email protected]在oled上控制一条狗的奔跑"/>技能梳理[email protected]在oled上控制一条狗的奔跑

Criu enables hot migration

ArcGIS Pro脚本工具(5)——排序后删除重复项

Use keil5 software to simulate and debug gd32f305 from 0
随机推荐
The programmer was beaten.
The performance of arm's new CPU has been improved by 22%, up to 12 cores can be combined, and the GPU is first equipped with hardware optical tracking. Netizen: the gap with apple is growing
ArcGIS Pro scripting tool (6) -- repairing CAD layer data sources
Foster design method
苹果高管公然“开怼”:三星抄袭 iPhone,只加了个大屏
Gd32 RT thread RTC driver function
mysql数据库基础:TCL事务控制语言
ionic4 ion-reorder-group组件拖拽改变item顺序
软件测试工程师面试基础题(应届生和测试小菜必备)最基础的面试题
运动App如何实现端侧后台保活,让运动记录更完整?
ArcGIS Pro + PS 矢量化用地规划图
Viewing technological changes through Huawei Corps (V): smart Park
Leetcode question brushing (IV) -- greedy thought (go Implementation)
Double-DQN笔记
Google 辟谣放弃 TensorFlow,它还活着!
马斯克推特粉丝过亿了,但他在线失联已一周
Skill sorting [email protected]+ Alibaba cloud +nbiot+dht11+bh1750+ soil moisture sensor +oled
六月集训(第30天) —— 拓扑排序
"Hackers and painters" -- why not be stupid
ArcGIS Pro脚本工具(5)——排序后删除重复项