WXLottie 1.1

WXLottie 1.1

acton393 维护。



 
依赖项
WeexPluginLoader>= 0
WeexSDK>= 0
lottie-ios>= 0
 

  • acton393

WXLottie

Pod version

WXLottie 是一个使用 lottieweex 组件插件

weex-toolkit 版本:>= 1.2.0 WeexSDK:>= 0.15.1

WeexLottie

lottie 项目

WeexLottie

example

使用方法

示例

<template>
  <div style='margin-top:50px;margin-left:150px'>
	<text style='margin-left:150px;border-width:2px;width:80px;' @click='click' :value="status"></text>
    <lottie src='http://127.0.0.1:12580/examples/animations/LottieWalkthrough.json' loop=true style='width:300px;height:300px'  ref='lottie'></lottie>
	<lottie src='http://127.0.0.1:12580/examples/animations/MotionCorpse-Jrcanest.json' loop=true style='width:300px;height:300px'  ref='lottie1'></lottie>
  </div>
</template>

<script>
  module.exports = {
    data: {
      play:false,
	  status:"play"
    },
    methods: {
      click : function(e) {
        var lottie = this.$refs.lottie;
		var lottie1 = this.$refs.lottie1;
        if (this.play) {
          this.play = false;
          lottie.reset();
	  lottie1.reset();
	  this.status = "play";
        }else {
          this.play = true;
          lottie.play();
	  lottie1.play();
	  this.status='stop'
        }
      }
    }
  }  
</script>

集成到您的项目中

WXLottie for iOS

  • 通过 weex 集成
weex plugin add weex-plugin-lottie
  • 通过 cocoaPods 集成
    1. 在您的 Podfile 中添加以下内容
      pod 'WXLottie'
      
    2. 在初始化 weexSDK 环境后注册此 weex 组件

WXLottie for Android

  • 通过 weex 集成
weex plugin add weex-plugin-lottie
  • 使用 Maven 集成
compile 'org.asialee.weex:weexplugin:1.0.0'
  • 使用源代码集成
  1. WXLottie.java 移动到您的项目中
  2. 集成 lottie
compile "com.airbnb.android:lottie:2.3.1"

然后不要忘记在您的 Application 中注册 WXLottie

WXSDKEngine.registerComponent("lottie", WXLottie.class);

WXLottie for Web

  • 通过 weex 集成
weex plugin add weex-plugin-lottie
  • 使用 npm 集成
npm i weex-plugin-lottie --save

然后不要忘记在您的 web 入口处注册 weex-plugin-lottie,如下所示

import Vue from 'vue';

import weex from 'weex-vue-render';

import weex-plugin-lottie from 'weex-plugin-lottie';

weex.init(Vue);

weex.install(weex-plugin-lottie)

const App = require('./index.vue');
App.el = '#root';
new Vue(App);