当前位置:网站首页>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); //启动动画播放
}
运行效果
边栏推荐
猜你喜欢
Robotframework learning notes: environment installation and robotframework browser plug-in installation
Using LVM to resize partitions
The programmer was beaten.
[email protected]体感机械臂"/>
技能梳理[email protected]体感机械臂
[email protected] control a dog's running on OLED"/>
Skill combing [email protected] control a dog's running on OLED
Q-Learning笔记
Review of mathematical knowledge: curve integral of the second type
pytorch 笔记 torch.nn.BatchNorm1d
ArcGIS Pro脚本工具(5)——排序后删除重复项
Auto Seg-Loss: 自动损失函数设计
随机推荐
记一次实习的经历,趟坑必备(一)
LVGL 8.2 Simple Drop down list
05_Node js 文件管理模块 fs
pytorch 笔记:validation ,model.eval V.S torch.no_grad
Pytorch notes torch nn. BatchNorm1d
mysql数据库基础:视图、变量
ArcGIS Pro scripting tool (5) - delete duplicates after sorting
技能梳理[email protected]体感机械臂
Gd32 RT thread RTC driver function
转卡通学习笔记
Use keil5 software to simulate and debug gd32f305 from 0
SGD has many improved forms. Why do most papers still use SGD?
历史上的今天:微软收购 PowerPoint 开发商;SGI 和 MIPS 合并
[rust weekly database] num bigint - large integer
matplotlib 笔记: contourf & contour
Agile Development: super easy to use bucket estimation system
Review of mathematical knowledge: curve integral of the second type
pytorch 筆記 torch.nn.BatchNorm1d
Skill sorting [email protected]+ Alibaba cloud +nbiot+dht11+bh1750+ soil moisture sensor +oled
那个程序员,被打了。