import React, { Component } from 'react';
const styles = {
  width: 100,
  height: 100,
}
class AnimationIcon extends Component {
  static defaultProps = {
    style: {},
    iconType: 'ok',
  }
  componentDidMount() {
    const { iconType } = this.props;
    bodymovin.loadAnimation({
      path: `/assets/newAnimat/${iconType}.json`,   // json文件路径
      loop: false,
      autoplay: true,
      renderer: 'svg',  // 渲染方式，有"html"、"canvas"和"svg"三种
      container: this.bodymovin,
    });
  }
  render() {
    return (
      <div
        ref={node => this.bodymovin = node}
        style={Object.assign({}, styles, this.props.style)}
      />
    );
  }
}

export default AnimationIcon;
