@xfe-team/live2d
v0.0.1
Published
live2d react component
Downloads
5
Readme
@xfe-team/live2d
live2d react component
Install
npm install --save @xfe-team/live2d
Usage
import React from 'react'
import Live2d from '@xfe-team/live2d'
class Example extends React.PureComponent {
render () {
return (
<Live2d
modelJsonUrl="//zhcdn01.xoyo.com/xassets/lib/live2d/unknown/example/model.json"
width="560"
height="500"
/>
)
}
}
API
Component.defaultProps = {
modelJsonUrl: '//zhcdn01.xoyo.com/xassets/lib/live2d/unknown/example/model.json',
live2dScriptUrl: '//zhcdn01.xoyo.com/xassets/lib/live2d/unknown/live2d.min.js'
};
Component.propsTypes = {
/**
* modelJson 看板娘配置地址
* 默认:‘//zhcdn01.xoyo.com/xassets/lib/live2d/unknown/example/model.json‘ (用于 demo)
*/
modelJsonUrl: string,
/**
* live2d 脚本地址
* 默认:'//zhcdn01.xoyo.com/xassets/lib/live2d/unknown/live2d.min.js'
*/
live2dScriptUrl: string,
/**
* canvas 宽度
*/
width: oneOfType([number, string]).isRequired,
/**
* canvas 高度
*/
height: oneOfType([number, string]).isRequired
};
License
MIT © xfe-team