@xfe-team/live2d

0.0.1 • Public • Published

@xfe-team/live2d

live2d react component

NPM JavaScript Style Guide

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

Readme

Keywords

none

Package Sidebar

Install

npm i @xfe-team/live2d

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

26.2 kB

Total Files

6

Last publish

Collaborators

  • licanbluesea
  • jf3096
  • zheever
  • oneli