How to stop the animation opa at the last opa value?

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.


What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

I want make a animation of opa , the end of the opa is not 100% , but the image’s opa is 100% automatic.

What have you tried so far?

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

void lv_obj_fade(lv_obj_t * obj, uint32_t time, uint32_t delay,uint8_t opa_start,uint8_t opa_end)
lv_anim_t a;
lv_anim_set_path_cb(&a, lv_anim_path_ease_in_out );
lv_anim_set_var(&a, obj);
lv_anim_set_values(&a, opa_start, opa_end);
lv_anim_set_exec_cb(&a, fade_anim_cb);
lv_anim_set_ready_cb(&a, fade_in_anim_ready);
lv_anim_set_time(&a, time);
lv_anim_set_delay(&a, delay);

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

It’s the very same as with opa just copy fade_anim_cb as img_fade_anim_cb and modify as:

static void fade_anim_cb(void * obj, int32_t v)
    lv_obj_set_style_img_opa(obj, v, 0);

Same with fade_in_anim_ready.