Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lottie: Animation Segment(Marker) Support #2044

Closed
hermet opened this issue Mar 11, 2024 · 6 comments
Closed

Lottie: Animation Segment(Marker) Support #2044

hermet opened this issue Mar 11, 2024 · 6 comments
Assignees
Labels
feature New feature additions lottie Lottie animation
Milestone

Comments

@hermet
Copy link
Member

hermet commented Mar 11, 2024

The concept of using markers in Lottie animations is known, where markers are used to control animation playback by specifying start and end points without needing to know the exact frame numbers.

Sample:
marker.json

API usage:

lottie->load("sample.json");

lottie->segment("sectionA") ;                    //specify the SectionA marked by Lottie spec.
auto frame = lottie->frameCnt();   //returns the "SectionA" frame count
auto duration = lottie->duration();  //returns the SectionA duration in seconds
...

lottie->segment(begin: 0.3, end: 0.7);        //specify the segment 0.3 ~ 0.7 ?
auto frame = lottie->frameCnt();       //returns the 0.3 ~ 0.7 frame count
auto duration = lottie->duration();    //returns the 0.3 ~ 0.7 duration in seconds
...
@hermet hermet added lottie Lottie animation feature New feature additions labels Mar 11, 2024
@hermet hermet changed the title Lottie: Marker Support Lottie: Animation Segment(Marker) Support Mar 11, 2024
@hermet hermet added this to the 0.14 milestone Mar 30, 2024
@hermet hermet pinned this issue Apr 6, 2024
@hermet
Copy link
Member Author

hermet commented Apr 6, 2024

Acquire Marker List

uint32_t LottieAnimation::markerCnt();  //return the marker count
const char* LottieAnimation::markers(uint32_t idx); //return the marker name by a given index.

@fall2019
Copy link
Member

fall2019 commented Apr 7, 2024

Okay. I will add it.

@hermet
Copy link
Member Author

hermet commented Apr 9, 2024

@theashraf Hello, Could you please confirm whether those following APIs would be satisfied with the dotLottie?

Result LottieAnimation::segment(const char* marker) ;  //specify the SectionA marked by Lottie spec.
uint32_t LottieAnimation::markerCnt();  //return the marker count
const char* LottieAnimation::markers(uint32_t idx); //return the marker name by a given index.
Result LottieAnimation::segment(float begin, float end) ;  //Perhaps, this is not necessary by dotlottie?

Please suggest any missing features if dotlottie requires.

@theashraf
Copy link
Member

@hermet

This would replace our current segment and marker management within the dotLottie player.

I believe these two APIs will be useful for dotLottie players:

Result LottieAnimation::segment(const char* marker);  // Specifies SectionA as marked by the Lottie specification.
Result LottieAnimation::segment(float begin, float end);  // Perhaps this is not necessary for dotLottie?

And I assume these two APIs are for retrieving all the markers available in a Lottie animation:

uint32_t LottieAnimation::markerCnt();  // Returns the count of markers.
const char* LottieAnimation::markers(uint32_t idx); // Returns the name of a marker by a given index.

I have two questions:

  • Is there a way to determine the beginning and ending frame number of a given marker ? cause we have a use case where the user want to know the segment value for UI purposes

  • Would applying a segment or a marker update the animation total_frames and duration information we get from tvg_get_total_frames and tvg_get_duration apis ?

@hermet
Copy link
Member Author

hermet commented Apr 10, 2024

@theashraf

  • Is there a way to determine the beginning and ending frame number of a given marker ? cause we have a use case where the user want to know the segment value for UI purposes

Makes sense. Probably, thorvg could provide an extra api:

//Return the begin, end values of the given marker.
Result LottieAnimation::segment(const char* marker, float* begin, float* end)
  • Would applying a segment or a marker update the animation total_frames and duration information we get from tvg_get_total_frames and tvg_get_duration apis ?

Yes.

I anticipate that dotLottie will replace the segment with the marker name. Could you please clarify in what scenarios dotLottie requires the use of this API?

Result LottieAnimation::segment(float begin, float end);  //Set the segment with a specific range.

@theashraf
Copy link
Member

@hermet

In dotLottie, we offer support for both named segments (Markers) and standard segments. So, the following API would be beneficial:

Result LottieAnimation::segment(float begin, float end);

This is useful in scenarios where users want to specify a custom segment for playback that does not have an associated named marker within the Lottie JSON

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature additions lottie Lottie animation
Projects
Status: Done 0.14
Development

No branches or pull requests

4 participants