什么是lottie

lottie-web

官网
可以在json

教程

  1. import lottie from 'lottie-web';
  2. import lottieData from '../../assets/goodjob.json';
  3. data() {
  4. return {
  5. lottieAnimation: null,
  6. }
  7. }
  8. this.lottieLoading();
  9. lottieLoading() {
  10. // const lottieDom = document.createElement('div');
  11. // lottieDom.setAttribute("id", "lottie-goodjob");
  12. let lottieDom = document.getElementById("lottie-goodjob");
  13. this.lottieAnimation = lottie.loadAnimation({
  14. container: lottieDom,
  15. renderer: 'svg',
  16. loop: false,
  17. autoplay: true,
  18. name: 'loading',
  19. animationData: lottieData,
  20. });
  21. this.lottieAnimation.addEventListener('complete', () => {
  22. this.lottieAnimation.destroy();
  23. // lottieDom.remove();
  24. });
  25. },

结合Lottie-web源码的深入分析

https://juejin.cn/post/7000273590830514212#heading-12

lottie系列文章

支付宝-翻牌领现金

飞书中 Lottie 动画的应用