实现效果
开关打开 左上角标签进入停止时有回弹效果 overshoot
开关关闭 标签退出速度由慢到快
几个主要函数
// /**
// * Set the start and end values of an animation 设置动画的起始值
// * @param a pointer to an initialized `lv_anim_t` variable
// * @param start the start value 初始位置
// * @param end the end value 结束位置
// */
//static inline void lv_anim_set_values(lv_anim_t * a, int32_t start, int32_t end)
lv_anim_set_exec_cb(&a, anim_x_cb);//执行动画
//**
// * Set the path (curve) of the animation. //设置动画的路径(曲线)
// * @param a pointer to an initialized `lv_anim_t` variable //动画对象
// * @param path_cb a function to set the current value of the animation.是设置动画当前值的函数 我理解为动画的执行效果
// */
//static inline void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb)

本文介绍如何使用LVGL库实现标签动画效果,包括开关控制动画的开启与关闭、动画的回弹效果及速度变化等。通过具体代码示例,展示了设置动画路径、执行回调函数等关键步骤。
最低0.47元/天 解锁文章
5287

被折叠的 条评论
为什么被折叠?



