# lv_lottie.h (/api/widgets/lottie/lv_lottie_h)



<RelatedHeaders name="lv_lottie_private.h" isPrivate="false" />

<ApiSummary functions="6" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (4)&#x22;,&#x22;Getters (1)&#x22;,&#x22;Other (1)&#x22;]">
  <ApiTab value="Setters (4)">
    <ApiMember kind="function" name="lv_lottie_set_buffer" file="widgets/lottie/lv_lottie.h" line="56" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/lottie/lv_lottie.h#L56">
      lv_lottie_set_buffer [#lv_lottie_set_buffer]

      Set a buffer for the animation. It also defines the size of the animation

      ```c title=" " lineNumbers=1
      void lv_lottie_set_buffer(lv_obj_t *obj, int32_t w, int32_t h, void *buf)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                                         |
      | ----- | ------------------------------------------------ | --------------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a lottie widget                          |
      | `w`   | <ApiLink name="int32_t" />                       | width of the animation and buffer                   |
      | `h`   | <ApiLink name="int32_t" />                       | height of the animation and buffer                  |
      | `buf` | `void *`                                         | a static buffer with `width x height x 4` byte size |
    </ApiMember>

    <ApiMember kind="function" name="lv_lottie_set_draw_buf" file="widgets/lottie/lv_lottie.h" line="63" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/lottie/lv_lottie.h#L63">
      lv_lottie_set_draw_buf [#lv_lottie_set_draw_buf]

      Set a draw buffer for the animation. It also defines the size of the animation

      ```c title=" " lineNumbers=1
      void lv_lottie_set_draw_buf(lv_obj_t *obj, lv_draw_buf_t *draw_buf)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                                       | Description                                           |
      | ---------- | ---------------------------------------------------------- | ----------------------------------------------------- |
      | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" />           | pointer to a lottie widget                            |
      | `draw_buf` | <ApiLink name="lv_draw_buf_t" display="lv_draw_buf_t *" /> | an initialized draw buffer with ARGB8888 color format |
    </ApiMember>

    <ApiMember kind="function" name="lv_lottie_set_src_data" file="widgets/lottie/lv_lottie.h" line="71" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/lottie/lv_lottie.h#L71">
      lv_lottie_set_src_data [#lv_lottie_set_src_data]

      Set the source for the animation as an array

      ```c title=" " lineNumbers=1
      void lv_lottie_set_src_data(lv_obj_t *obj, const void *src, size_t src_size)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name       | Type                                             | Description                                               |
      | ---------- | ------------------------------------------------ | --------------------------------------------------------- |
      | `obj`      | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a lottie widget                                |
      | `src`      | `const void *`                                   | the lottie animation converted to an nul terminated array |
      | `src_size` | <ApiLink name="size_t" />                        | size of the source array in bytes                         |
    </ApiMember>

    <ApiMember kind="function" name="lv_lottie_set_src_file" file="widgets/lottie/lv_lottie.h" line="79" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/lottie/lv_lottie.h#L79">
      lv_lottie_set_src_file [#lv_lottie_set_src_file]

      Set the source for the animation as a path. Lottie doesn't use LVGL's File System API.

      ```c title=" " lineNumbers=1
      void lv_lottie_set_src_file(lv_obj_t *obj, const char *src)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                                   |
      | ----- | ------------------------------------------------ | --------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a lottie widget                    |
      | `src` | `const char *`                                   | path to a json file, e.g. "path/to/file.json" |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (1)">
    <ApiMember kind="function" name="lv_lottie_get_anim" file="widgets/lottie/lv_lottie.h" line="86" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/lottie/lv_lottie.h#L86">
      lv_lottie_get_anim [#lv_lottie_get_anim]

      Get the LVGL animation which controls the lottie animation

      ```c title=" " lineNumbers=1
      lv_anim_t * lv_lottie_get_anim(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                |
      | ----- | ------------------------------------------------ | -------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a lottie widget |

      **Returns:** <ApiLink name="lv_anim_t" display="lv_anim_t *" /> — the LVGL animation
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (1)">
    <ApiMember kind="function" name="lv_lottie_create" file="widgets/lottie/lv_lottie.h" line="47" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/widgets/lottie/lv_lottie.h#L47">
      lv_lottie_create [#lv_lottie_create]

      Create a lottie animation

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_lottie_create(lv_obj_t *parent)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                             | Description                  |
      | -------- | ------------------------------------------------ | ---------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to the parent widget |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the created Lottie animation widget
    </ApiMember>
  </ApiTab>
</ApiTabs>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_types.h&#x22;, &#x22;lv_draw_buf.h&#x22;]" includedBy="[&#x22;lv_lottie_private.h&#x22;]" transitiveIncludes="[&#x22;lv_area.h&#x22;, &#x22;lv_assert.h&#x22;, &#x22;lv_color.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_conf_internal.h&#x22;, &#x22;lv_conf_kconfig.h&#x22;, &#x22;lv_image_dsc.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_string.h&#x22;]" />
