-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Question] v6 - How to dynmically set height #1131
Comments
Hey there, Save the width and height of each animation with their JSON files in your CMS. This data can be used to create styles based on the server's response. |
@matinzd Thanks, that what I though, there is no longer any way to dynamically do it client side, meaning we cannot move to v6 until we add this functionality to our CMS. Thanks for your reply PS : any plans to add this functionality back? Or some king of helper to get the animation ratio ? |
This functionality was really appreciate. It is bizarre that no more developer create tickets about it. I start a function to get proportional size but it need some adjustments:
In this example, 420 is my screen width, and I want to get proportional height. I think, it is by default, when your export your animation. It's working only with Lottie JSON file, not this DotLottie file. |
When I find some time. I will try to expose a native method so that you get the width and height of the animation file. The previous default behavior could cause a lot of problems in terms of the API. With dotLottie coming up, it's not possible anymore to read the width and height directly from the file itself unless I read their protocol for its binary implementation. |
I think we should probably pin this issue for future reference. Sadly, the API that we used to provide for this functionality was extremely flawed and relied too much on Lottie only using JSON and that JSON file being formatted in a specific way. |
@matinzd Any update on exposing a method for this? With v6 being necessary for Apple guidelines sometime soon this is still a blocker for us to upgrade. |
@matinzd Really need a guideline for this issue. If you can suggest a solution, I think if you don't have time to do it, there will be plenty people willing to help. We have upgraded to v6, and all of the sudden, all the lottie views disappear. |
Description
In previous version I could only specify width to 100% and LottieView would automatically have the correct height, keeping the json ratio.
I read #1078 but I think I am missing something here.
In my scenario the content team can manage the content of our pages from a CMS and they upload animation's json to it.
We then fetch them from URL, having no way to know their size, or ratio.
The current README states we can use this code
but it does not work except if width and height are set, which seems coherent with the v6 changelog.
Can you please explain if there is a way to achieve this in v6?
Lottie Version
Version: 6.4.0
The text was updated successfully, but these errors were encountered: