-
Notifications
You must be signed in to change notification settings - Fork 28
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
Using dot-lottie player programatically, #45
Comments
Anyone? For layout reasons, I need to change the inner svg's 'preserveAspectRatio'-attribute to 'xMidYMid slice'. So in order to know when the dotlottie-player is ready, I now have to use a mutationobserver on the |
I am using a Vue 2.6 app and attempting to grab the I am seeing the same thing as what you said - I have to load the lottie animation first (using the Quick mockup:
Honestly, the documentation for this lottie module and many others is poor. It's barebones at best and leaves out crucial implementation details and "gotchas" like this one. You also can't supply a dummy URL to |
hey @zsmithjc sorry for the frustration. I'll look in to bettering this. But within your example, I think you can replace 'waitForLottieAnimationLoaded' with an event listener:
This is how I do it with React: https://codesandbox.io/s/lotties-always-loop-false-forked-p70hnz?file=/src/App.tsx |
Thank you, @samuelOsborne - that helped me a lot as well :) Maybe you could point me in the right direction with another small issue I have: With the bodymovin-player, I can do something like this: const player = bodymovin.loadAnimation({ Is it possible to reach the 'rendererSettings' object with dot-lottie player in the same manner? It would be nice to be able to set it up correctly before it is created in the page. Best regards |
hey @martinstender yes if you use the load method, you can pass an object that will be passed to the renderSettings: For example:
|
Thank you, @samuelOsborne - can I set autoplay, loop etc. the same way? |
@samuelOsborne so, trying out your suggestion to replace the
Attempting to use Using the pre-existing interval is the only way I've seen to know when the element is loaded in - as the loading of the animation determines when methods like |
@zsmithjc Your listener shouldn't be on |
@samuelOsborne yes, I tried that in the code snippet.
I was just saying neither option works before the animation loads in, and only |
Please have a look at the dotlottie react player -> https://www.npmjs.com/package/@dotlottie/react-player |
In the documentation, it says that the Lottie-player can be set and loaded programmatically. For better (or maybe worse), we still use requirejs, and using the 'bodymovin' player, this works just fine:
I'm trying to do something similar with the dotlottie-player - something like this:
But it doesn't seem to work. What am I missing? And is there more documentation available somewhere for programmatic use?
TIA :)
Martin
The text was updated successfully, but these errors were encountered: