Coder Social home page Coder Social logo

Comments (8)

kisvegabor avatar kisvegabor commented on June 14, 2024 3

Hi @hermet,

It works, thank you for the quick help! 🎉

    tvg_canvas_draw(tvg_canvas);
    tvg_canvas_sync(tvg_canvas);

were the missing pieces. LVGL will have out of the box Lottie support with ThorVG soon.

I'm planning to demonstrate it on Embedded World on the booth of NXP, ST, Espressif, and Renesas.

If you will also visit Embedded World it would be amazing to meet personally.

from thorvg.

kisvegabor avatar kisvegabor commented on June 14, 2024 2

I works like a charm with v0.12.x. Thank you for the support!

I'll report back with a video when all work together 🙂

from thorvg.

hermet avatar hermet commented on June 14, 2024

@kisvegabor Hello, good news.

Could you please double-check the return value?

 Tvg_Result result = tvg_picture_load_data(paint, approve_lottie, sizeof(approve_lottie), "lottie", true);

Just in case, thorvg expects a define value to successfully build the lottie feature.

#define THORVG_TVG_LOADER_SUPPORT 1

from thorvg.

hermet avatar hermet commented on June 14, 2024

@kisvegabor Please double check this src: I confirmed the given lottie asset(approve_lottie) works my side.

    //setup lvgl canvas
    static uint32_t buffer[WIDTH * HEIGHT];                                 //canvas target buffer

    lv_obj_t * lv_canvas =  lv_canvas_create(lv_screen_active());
    lv_canvas_set_buffer(lv_canvas, buffer, WIDTH, HEIGHT, LV_COLOR_FORMAT_ARGB8888);
    lv_canvas_fill_bg(lv_canvas, lv_color_hex3(0x32f), 0xff);

    //setup tvg canvas
    Tvg_Canvas* tvg_canvas = tvg_swcanvas_create();
    tvg_swcanvas_set_target(tvg_canvas, buffer, WIDTH, WIDTH, HEIGHT, TVG_COLORSPACE_ARGB8888);
   
    //setup lottie animation
    Tvg_Animation * anim = tvg_animation_new();
    Tvg_Paint * paint = tvg_animation_get_picture(anim);
    tvg_picture_load_data(paint, approve_lottie, sizeof(approve_lottie), "lottie", true);
    tvg_picture_set_size(paint, 100, 100);

    float d = 0;
    tvg_animation_get_duration(anim, &d);	/*d = 1.0*/

    uint32_t f = 0;
    tvg_animation_get_total_frame(anim, &f);	/*f=60*/
    tvg_animation_set_frame(anim, 40);

    //push the lottie picture
    tvg_canvas_push(tvg_canvas, paint);

    //draw it & complete it.
    tvg_canvas_draw(tvg_canvas);
    tvg_canvas_sync(tvg_canvas);

from thorvg.

kisvegabor avatar kisvegabor commented on June 14, 2024

Do you also see the extra dot in the top right corner?Could it be an issue with the source?
lottie_dot

I'm using this code based on the previous initialization.

  uint32_t i = 0;
  while(1) {
	  tvg_animation_set_frame(anim, i % f);
	  tvg_canvas_update(tvg_canvas);
	  tvg_canvas_draw(tvg_canvas);
	  tvg_canvas_sync(tvg_canvas);
	  lv_obj_invalidate(lv_canvas);
	  lv_timer_handler();
	  usleep(100 * 1000);
	  i++;
  }

from thorvg.

JSUYA avatar JSUYA commented on June 14, 2024

Hi You need this patch #2024 (there may be more PR related to this)
I recommend to upgrade the version.

from thorvg.

hermet avatar hermet commented on June 14, 2024

@kisvegabor This patch will fix it: #1932

I strongly recommend you to upgrade thorvg with v0.12.x.
Lottie features has been significantly enhanced since the v0.11.x

from thorvg.

hermet avatar hermet commented on June 14, 2024

were the missing pieces. LVGL will have out of the box Lottie support with ThorVG soon.

I'm planning to demonstrate it on Embedded World on the booth of NXP, ST, Espressif, and Renesas.

If you will also visit Embedded World it would be amazing to meet personally.

By the way, congratulations! I hope people will be able to see the Lottie animation on such small devices!

from thorvg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.