当前位置:网站首页>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); //启动动画播放
}
运行效果
边栏推荐
- Mysql database foundation: TCL transaction control language
- mysql数据库基础:视图、变量
- Skill combing [email protected] intelligent instrument teaching aids based on 51 series single chip microcomputer
- Arm新CPU性能提升22%,最高可组合12核,GPU首配硬件光追,网友:跟苹果的差距越来越大了...
- Voir le changement technologique à travers la Légion Huawei (5): Smart Park
- 那个程序员,被打了。
- 技能梳理[email protected]體感機械臂
- 机器学习面试准备(一)KNN
- Remember the experience of an internship. It is necessary to go to the pit (I)
- Dow Jones Industrial Average
猜你喜欢
Robotframework learning notes: environment installation and robotframework browser plug-in installation
ArcGIS PRO + PS vectorized land use planning map
从0使用keil5软件仿真调试GD32F305
智能DNA分子纳米机器人模型来了
Use keil5 software to simulate and debug gd32f305 from 0
透過華為軍團看科技之變(五):智慧園區
ArcGIS Pro + PS 矢量化用地规划图
CSDN博客运营团队2022年H1总结
[email protected]体感机械臂"/>
技能梳理[email protected]体感机械臂
数学知识复习:第二型曲线积分
随机推荐
Compétences Comb 27 @ Body sense Manipulator
马斯克推特粉丝过亿了,但他在线失联已一周
Robotframework learning notes: environment installation and robotframework browser plug-in installation
GD32 RT-Thread flash驱动函数
Agile Development: super easy to use bucket estimation system
Go -- standard library sort package
技能梳理[email protected]基于51系列单片机的智能仪器教具
Migrate full RT thread to gd32f4xx (detailed)
Musk has more than 100 million twitter fans, but he has been lost online for a week
Mysql database foundation: views and variables
滴滴开源敏捷测试用例管理平台!
历史上的今天:微软收购 PowerPoint 开发商;SGI 和 MIPS 合并
MySQL从入门到精通50讲(三十二)-ScyllaDB生产环境集群搭建
Leetcode question brushing (III) -- binary search (go Implementation)
[deep learning] common methods for deep learning to detect small targets
Turn to cartoon learning notes
GD32 RT-Thread PWM驱动函数
59 websites programmers need to know
Smith chart view of semi steel coaxial RF line and RF line matching calibration of network analyzer e5071c
pytorch 筆記 torch.nn.BatchNorm1d