当前位置:网站首页>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); //启动动画播放
}
运行效果图

边栏推荐
- Musk has more than 100 million twitter fans, but he has been lost online for a week
- 断路器HystrixCircuitBreaker
- 机器学习面试准备(一)KNN
- The human agent of kDa, Jinbei kd6, takes you to explore the metauniverse
- CSDN blog operation team 2022 H1 summary
- Mysql database foundation: views and variables
- 19:00 p.m. tonight, knowledge empowerment phase 2 live broadcast - control panel interface design of openharmony smart home project
- RobotFramework学习笔记:环境安装以及robotframework-browser插件的安装
- Leetcode question brushing (IV) -- greedy thought (go Implementation)
- Remember the experience of an internship. It is necessary to go to the pit (I)
猜你喜欢
[email protected]基于51系列单片机的智能仪器教具"/>技能梳理[email protected]基于51系列单片机的智能仪器教具

Remember the experience of an internship. It is necessary to go to the pit (I)

Test memory read rate

Implementation of monitor program with assembly language

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

移植完整版RT-Thread到GD32F4XX(详细)

Voir le changement technologique à travers la Légion Huawei (5): Smart Park

WGet -- 404 not found due to spaces in URL

Musk has more than 100 million twitter fans, but he has been lost online for a week

逸仙電商發布一季報:堅持研發及品牌投入,實現可持續高質量發展
随机推荐
Gd32 RT thread flash driver function
About Library (function library), dynamic library and static library
同事的接口文档我每次看着就头大,毛病多多。。。
Go -- standard library sort package
Skill sorting [email protected]+adxl345+ Motor vibration + serial port output
安徽《合肥市装配式建筑施工图审查设计深度要求》印发;河北衡水市调整装配式建筑预售许可标准
GD32 RT-Thread PWM驱动函数
Overview of currency
Q-Learning笔记
IPhone address book import into Excel
59 websites programmers need to know
Dow Jones Industrial Average
机器学习面试准备(一)KNN
ArcGIS Pro脚本工具(5)——排序后删除重复项
吴恩达2022机器学习专项课测评来了!
Machine learning interview preparation (I) KNN
Get through the supply chain Shenzhen gift show helps cross-border e-commerce find ways to break the situation
Musk has more than 100 million twitter fans, but he has been lost online for a week
Mysql database foundation: constraint and identification columns
CSDN daily one practice 2021.11.06 question 1 (C language)