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>