lottie

首次使用weexplus plugin add https://github.com/farwolf2010/lottie

demo

  1. <template>
  2. <scroller>
  3. <text style='margin-left:350px;margin-bottom:20px;border-width:2px;width:80px;alignItem:center;margin-top: 80px' @click='click' :value="status"></text>
  4. <div style="flex-direction:row">
  5. <lottie src='root:file/LottieWalkthrough.json' loop=true style='flex:1;height:300px' ref='lottie'></lottie>
  6. <lottie src='root:file/MotionCorpse-Jrcanest.json' loop=true style='flex:1;height:300px' ref='lottie1'></lottie>
  7. </div>
  8. <div style="flex-direction:row">
  9. <lottie src='root:file/LineAnimation.json' loop=true style='flex:1;height:300px' ref='lottie2'></lottie>
  10. <lottie src='root:file/TwitterHeart.json' loop=true style='flex:1;height:300px' ref='lottie3'></lottie>
  11. </div>
  12. <div style="flex-direction:row">
  13. <lottie src='root:file/9squares-AlBoardman.json' loop=true style='flex:1;height:300px' ref='lottie4'></lottie>
  14. <lottie src='root:file/LottieLogo1.json' loop=true style='flex:1;height:300px' ref='lottie5'></lottie>
  15. </div>
  16. <div style="flex-direction:row">
  17. <lottie src='root:file/HamburgerArrow.json' loop=true style='flex:1;height:300px' ref='lottie6'></lottie>
  18. <lottie src='root:file/Watermelon.json' loop=true style='flex:1;height:300px' ref='lottie7'></lottie>
  19. </div>
  20. </scroller>
  21. </template>
  22. <script>
  23. module.exports = {
  24. data: {
  25. play:false,
  26. status:"play"
  27. },
  28. methods: {
  29. click : function(e) {
  30. var lottie = this.$refs.lottie;
  31. var lottie1 = this.$refs.lottie1;
  32. var lottie2 = this.$refs.lottie2;
  33. var lottie3 = this.$refs.lottie3;
  34. var lottie4 = this.$refs.lottie4;
  35. var lottie5 = this.$refs.lottie5;
  36. var lottie6 = this.$refs.lottie6;
  37. var lottie7 = this.$refs.lottie7;
  38. if (this.play) {
  39. this.play = false;
  40. lottie.reset();
  41. lottie1.reset();
  42. lottie2.reset();
  43. lottie3.reset();
  44. lottie4.reset();
  45. lottie5.reset();
  46. lottie6.reset();
  47. lottie7.reset();
  48. this.status = "play";
  49. }else {
  50. this.play = true;
  51. lottie.play();
  52. lottie1.play();
  53. lottie2.play();
  54. lottie3.play();
  55. lottie4.play();
  56. lottie5.play();
  57. lottie6.play();
  58. lottie7.play();
  59. this.status='stop'
  60. }
  61. }
  62. }
  63. }
  64. </script>