Lottie is a mobile library for Web, and iOS that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile! For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand.
1. gif: 优势:简单。 缺点:掉帧很是严重,体验不流畅,严重影响用户体验,对于小Icon也许勉强能够接受,但对于较大面积的动画确定不行php
2. video: 优势:兼容性好。 缺点(web端)以下所示:html
<head> <script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.5.9/lottie.js"></script> </head> <body style="background-color:#ccc; margin: 0px;height: 100%;"> <div style="width:100%;height:100%;" id="bodymovin"></div> <script> var animData = { wrapper: document.getElementById('bodymovin'), animType: 'html', loop: true, prerender: true, autoplay: true, path: './data.json' }; var anim = bodymovin.loadAnimation(animData); </script> </body>