Lottie动画 (lv_lottie)

Overview(概览)

显示原文

The Lottie widget is capable of parsing, rasterizing, and playing Lottie animations.

The Lottie animations are vector based animation. Think of it as the modern combination of SVG and GIF.

The animations can be downloaded from various sources, such as https://lottiefiles.com/ or you can create your own animations using for example Adobe After Effects.

The Lottie widget is based on Canvas(画布)(lv_canvas) because in order to render the animation the user needs to provide a buffer where the current frame is stored.


Lottie 控件能够解析、光栅化以及播放 Lottie 动画

Lottie 动画是基于矢量的动画。可以将其视为 SVG 和 GIF 的现代组合。

动画可以从多种来源下载,比如 https://lottiefiles.com ,或者你可以使用例如 Adobe After Effects 来创建自己的动画。

Lottie 控件基于 Canvas(画布)(lv_canvas) 所以为了能渲染动画,用户需要提供一个缓冲区来存储当前帧。

Parts and Styles(部分和样式)

显示原文
  • LV_PART_MAIN The background of the Lottie animation. The typical background style properties apply but usually it is left transparent.


  • LV_PART_MAIN 动画的背景。通常背景样式属性适用,但默认保持透明。

Usage(用法)

Dependencies(依赖)

显示原文

The Lottie Widget uses the ThorVG library which is integrated into LVGL. In order to use Lottie animations LV_USE_THORVG_INTERNAL (to use the built-in ThorVG) or LV_USE_THORVG_EXTERNAL (to link it externally) needs to enabled in lv_conf.h. For vector graphics in general LV_USE_VECTOR_GRAPHIC also needs to be enabled.

As ThorVG is written in C++, when using LV_USE_THORVG_INTERNAL be sure that you can compile the cpp files.


Lottie 部件使用了 ThorVG <https://github.com/thorvg/thorvg>`__库,该库已集成到LVGL中 `integrated into LVGL

为了使用 Lottie 动画,需要在 lv_conf.h 中启用:c:macro:LV_USE_THORVG_INTERNAL`(使用内置的 ThorVG)或:c:macro:`LV_USE