Comments (15)
@berendvaneerde Hi. I think the loadAnimation method might work for you.
you pass an object with the necessary params (look on the readme file for all the possible configurations). You can set the autoplay and loop flags to false on your case.
It returns an animation instance you can control and call the play, stop, pause, gotoAndStop and other methods on it.
I will update the documentation to reflect this.
from lottie-web.
Thank you for your quick response.
I tried the loadAnimation method before, but no succes. I am not sure how to load the json file in animationData param: do I just route to it?
like: {animationData: JSON.parse('../animations/logo_reveal/data.json')}
from lottie-web.
@berendvaneerde Instead of using animationData, use path and pass the json path.
something like:
bodymovin.loadAnimation({
wrapper: element, // the dom element
animType: 'svg',
loop: true,
autoplay: true,
path: '../animatoins/logo_reveal/data.json'
});
It's not on the documentation either :/
I'll update it.
from lottie-web.
Thanks for your help. Getting further
Still no luck though: I get the following error
Uncaught TypeError: this.animationItem.wrapper.appendChild is not a function
SVGRenderer.configAnimation @ bodymovin.js?ver=4.2.5:2
AnimationItem.configAnimation @ bodymovin.js?ver=4.2.5:4
AnimationItem.setParams.r.onreadystatechange @ bodymovin.js?ver=4.2.5:4
from lottie-web.
@berendvaneerde what did you pass as wrapper? you need to pass a dom element.
from lottie-web.
as following
var logoReveal = $('#logoreveal'); //corresponding to a dom element in my html
bodymovin.loadAnimation({
wrapper: logoReveal, // the dom element
animType: 'svg',
loop: false,
autoplay: true,
path: 'wp-content/themes/botoboto/library/animations/logo_reveal/data.json'
});
from lottie-web.
GOT IT! appears that my jquery doesn't work... Does it need to be pure javascript?
from lottie-web.
@berendvaneerde nice!
yes, for the moment it only supports pure javascript.
from lottie-web.
aha! So how about calling bodymovin.play('name') inside a jquery function?
Is that the reason why that is not working?
from lottie-web.
@berendvaneerde no, I think that might be another issue. If you have a working example, I'll take a look.
from lottie-web.
I'm on the right track now! Thanks to your hint on the gotoAndStop method. Logical to reset the animation to a starting point, before you can play it again, but I never saw that method before your post ;) I've got a mouseover working now. Is there also a method to give the animation another frame at load or so?
Perhaps I just need to dive into the code more, but your plugin definitely deserves some more documentation on these methods as well! All in time of course :) Thanks very much for your help. I feel like I can go to bed now with this little victory!
from lottie-web.
@berendvaneerde what do you mean by giving another frame at load? to display another frame by default on load?
I'm glad it works :)
from lottie-web.
yes! That's what I mean
from lottie-web.
@berendvaneerde no it doesn't but it makes sense. I'll add it to my todo list
from lottie-web.
Great! Thanks again...
from lottie-web.
Related Issues (20)
- Validating JSON Files as Lottie Animations HOT 1
- Animation has strange artifacts when rendering with canvas renderer HOT 2
- Console Log Error: <rect> attribute transform: Expected number, "matrix(NaN,NaN,NaN,NaN,…"
- json import fails
- 'setDirection' not working when combined with 'playSegments'
- AE Bodymovin SVG SMIL export fails if using position animation with separated dimensions
- Which filters are supported by canvas types
- destination folder line length
- After Effects text layers without animators are rendered in single characters.
- Image display issue HOT 1
- My after effects's lottie plugin wont open
- Update property with JS HOT 1
- Not sure if bug or dumb — Lottie-Web does not seem to follow pause() method consistently
- Bug: Animation with multiple segments loops the last segment only HOT 5
- Add/Update Rive Export from Bodymovin
- I can't edit the text value of the text layer keyframe in After Effects.
- How to disable transform3d to svg? HOT 1
- Telegram stickers HOT 1
- After Effects scripting support for BodyMovin? HOT 2
- dynamic json modify
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lottie-web.