当前位置:网站首页>LVGL 8.2 Image styling and offset
LVGL 8.2 Image styling and offset
2022-06-30 10:08:00 【仙剑情缘】
动画执行回调函数
static void ofs_y_anim(void* img, int32_t v)
{
lv_img_set_offset_y(img, v); //设置image控制y方向偏移
}
Image styling and offset
/** * Image styling and offset */
static void lv_example_img_4(void)
{
LV_IMG_DECLARE(img_skew_strip); //图片资源声明
static lv_style_t style;
lv_style_init(&style);
lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_YELLOW)); //背景设置黄色
lv_style_set_bg_opa(&style, LV_OPA_COVER); //透明度为Cover
lv_style_set_img_recolor_opa(&style, LV_OPA_COVER);//设置重新重色的透明度为Cover
lv_style_set_img_recolor(&style, lv_color_black()); //设置重新着色的颜色为黑色
lv_obj_t* img = lv_img_create(lv_scr_act()); // 创建Image对象
lv_obj_add_style(img, &style, 0); //添加style
lv_img_set_src(img, &img_skew_strip); //设置显示图片源
lv_obj_set_size(img, 150, 100); // 设置大小
lv_obj_center(img); //居中显示
lv_anim_t a;
lv_anim_init(&a); //初时化动画变量
lv_anim_set_var(&a, img); // 设置关联动画的控制img
lv_anim_set_exec_cb(&a, ofs_y_anim); //设置动画执行回调函数
lv_anim_set_values(&a, 0, 100); //设置播放的起始值和结束值0~100
lv_anim_set_time(&a, 3000); //设置动画播放持续时间3000毫秒
lv_anim_set_playback_time(&a, 500); // 设置动画回播时间500毫秒
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); //设置动画重新次数,无穷次
lv_anim_start(&a); //启动动画播放
}
运行效果图

边栏推荐
- matplotlib 笔记: contourf & contour
- Foresniffer tutorial: extracting data
- WGet -- 404 not found due to spaces in URL
- 潘多拉 IOT 开发板学习(HAL 库)—— 实验1 跑马灯(RGB)实验(学习笔记)
- Skill combing [email protected] voice module +stm32+nfc
- Q-Learning笔记
- Pytorch Notebook. Nn. Batchnorm1d
- Gd32 RT thread RTC driver function
- Didi open source agile test case management platform!
- Apple's 5g chip was revealed to have failed in research and development, and the QQ password bug caused heated discussion. Wei Lai responded to the short selling rumors. Today, more big news is here
猜你喜欢

透过华为军团看科技之变(五):智慧园区

透過華為軍團看科技之變(五):智慧園區

Kernel linked list (general linked list) "list.h" simple version and individual comments

Q-Learning笔记

pytorch 笔记 torch.nn.BatchNorm1d
[email protected]+adxl345+ Motor vibration + serial port output"/>Skill sorting [email protected]+adxl345+ Motor vibration + serial port output
[email protected]+ Alibaba cloud +nbiot+dht11+bh1750+ soil moisture sensor +oled"/>Skill sorting [email protected]+ Alibaba cloud +nbiot+dht11+bh1750+ soil moisture sensor +oled

IPhone address book import into Excel

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

sCrypt 中的 ECDSA 签名验证
随机推荐
Agile Development: super easy to use bucket estimation system
敏捷开发: 超级易用水桶估计系统
RobotFramework学习笔记:环境安装以及robotframework-browser插件的安装
转卡通学习笔记
Skill combing [email protected] somatosensory manipulator
Test memory read rate
Gd32 RT thread RTC driver function
"Kunming City coffee map" was opened again, and coffee brought the city closer
Android 开发面试真题进阶版(附答案解析)
Mysql database foundation: views and variables
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
Using LVM to resize partitions
超长干货 | Kubernetes命名空间详解
GD32 RT-Thread OTA/Bootloader驱动函数
苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...
I found a wave of "alchemy artifact" in the goose factory. The developer should pack it quickly
ArcGIS Pro scripting tool (6) -- repairing CAD layer data sources
05_Node js 文件管理模块 fs
SGD有多种改进的形式,为什么大多数论文中仍然用SGD?
在 sCrypt 中实现高效的椭圆曲线点加法和乘法