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

feat: 🎸 expose lottie animation original size #180

Merged
merged 6 commits into from
Jun 22, 2024
Merged

Conversation

theashraf
Copy link
Member

@theashraf theashraf commented Jun 14, 2024

This pull request introduces a new feature to expose the original size of an animation using the tvg_picture_get_size function from the ThorVG C API. The retrieved animation size information is then stored in the LottieRenderer for future queries.

Changes

  • dotlottie-ffi/Cargo.wasm.toml: Updated package version to 0.1.22.
  • dotlottie-ffi/emscripten_bindings.cpp: Added animationSize function binding to DotLottiePlayer.
  • dotlottie-ffi/src/dotlottie_player.udl: Added animation_size function to the DotLottiePlayer interface.
  • dotlottie-ffi/src/dotlottie_player_cpp.udl: Added animation_size function to the DotLottiePlayer interface.
  • dotlottie-rs/src/dotlottie_player.rs: Implemented animation_size method to return the width and height of the loaded animation.
  • dotlottie-rs/src/lottie_renderer/mod.rs: Added picture_width and picture_height fields to LottieRenderer and initialized them in the load method.
  • web-example.html: Updated example to log the animation size using the new animationSize method.

Usage

let dotlottie_player = DotLottiePlayer::new(Config::default());

// Method to return a vec [width, height] as retrieved from `tvg_picture_get_size`
dotlottie_player.animation_size();

fix #175

Copy link

changeset-bot bot commented Jun 14, 2024

⚠️ No Changeset found

Latest commit: afcaeee

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@theashraf theashraf self-assigned this Jun 14, 2024
@theashraf theashraf merged commit aa7cd67 into main Jun 22, 2024
1 check passed
@github-actions github-actions bot mentioned this pull request Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

expose animation size
2 participants