{"name":"rc-bullets","version":"1.5.12","description":"awesome barrage powered by CSS3 animation and built by react ","author":{"name":"zerosoul"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/zerosoul/rc-bullets.git"},"main":"dist/index.js","module":"dist/index.es.js","jsnext:main":"dist/index.es.js","homepage":"https://zerosoul.github.io/rc-bullets","engines":{"node":">=10","npm":">=6"},"keywords":["弹幕","danmaku","barrage","bullet","react","CSS3","年会"],"scripts":{"build":"NODE_ENV=production rollup -c","start":"rollup -c -w","prepare":"rm -rf ./dist && yarn build","predeploy":"cd example && yarn build","deploy":"gh-pages -d example/build"},"peerDependencies":{"react":"^16.13.1","react-dom":"^16.13.1"},"devDependencies":{"@babel/core":"^7.10.2","@babel/plugin-proposal-class-properties":"^7.10.1","@babel/preset-env":"^7.10.2","@babel/preset-react":"^7.10.1","@svgr/rollup":"^5.4.0","babel-eslint":"^10.1.0","babel-plugin-styled-components":"^1.10.7","cross-env":"^7.0.2","eslint":"^7.1.0","eslint-config-prettier":"^6.11.0","eslint-plugin-react":"^7.20.0","eslint-plugin-react-hooks":"^4.0.4","gh-pages":"^3.0.0","prettier":"^2.0.5","react":"^16.13.1","react-dom":"^16.13.1","react-scripts":"^3.4.1","rollup":"^2.13.1","rollup-plugin-babel":"^4.4.0","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-peer-deps-external":"^2.2.2","rollup-plugin-terser":"^6.1.0","rollup-plugin-url":"^3.0.1"},"dependencies":{"color-convert":"^2.0.1"},"gitHead":"c583e7d30164bd5d12ea613418b143207efd30c3","bugs":{"url":"https://github.com/zerosoul/rc-bullets/issues"},"_id":"rc-bullets@1.5.12","_nodeVersion":"12.13.1","_npmVersion":"6.12.1","dist":{"integrity":"sha512-qwZCSwzXbXLQ5cRZzpA4r6DtSvEkhJ5s9fmUEHM/hfiLifgCo3OsSs2Ngy20KxcbudOHxyHAOPe93Cr5IRoHlw==","shasum":"84e07ae05bdefca17550955783ae4db56de692ae","tarball":"http://registry-npm.ywwl.com/rc-bullets/download/rc-bullets-1.5.12.tgz","fileCount":6,"unpackedSize":197434,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe2LkzCRA9TVsSAnZWagAAU74QAIFGb5AgprR+AiKvvVTV\nRSuPdP25SGUz3awr9UbjbwcuS9RdADGGsYTy8BjYLQ3wZM0Zq1+5atrYyn0Q\n7UaFksCDUaSrEpb9g6fKZz2SudmlMwo9m1UIZinKsTT01FsykgdTJ6iEQ+Qc\nwXGhxHEFSrC8o1cTLWbMnprDigX02t3jCHF3OkhlHJJop06iQNLuc/a8EIiw\n4Aq/1+QdPsuNDcWiJiheb1/i6a/QB52Sf1c4LqOuBplPgv/t3xZK+KQu+ET0\nBvnh95pkipvVMiNbUXFfxiKu/gZb8r7sCV5RjlW3KMSzqD5lGnEDMVo2Wp5G\nO2ffSKCaORTJj62je78lB3kMrRGYv9+pDid5cLD1f1fZp4YsgsX0SxacKxGI\nM9UcJ2hHJ3t1ZSYKfPeHFKwG4twz8LoX+Y+zJL3qJme8c+msMupTmYIHbQd1\nP04X2OtZMrg4Kzxf1VVr/OS1273PwyMq82VfvAe2Mqj7WQTUqUsIoHV2ckw1\nD41aQswxleJ180FzvmKni1C1fDGcJK4/65+t24TBSpHdRYLNKghzox5J1znZ\no62QuyuZ2lOgALoBAEKC10uEWcreJ/paIVCxv1ZwjyCxUROaBgwpDRrZO72J\nbxla0U5yaIkSbNtG+tVzgXh8QoKCmTG89+DQVgWx24hoX2wHSMmjfGsZFdUi\nLaZN\r\n=xkrI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDb7UMq0AJraftBSKAxnnU7BEu2LNkALNaltTUCKRkFWQIhALZdMFZODMCO1jdccimshQn6pLnmV2TDPU3uRX4ySKrj"}],"size":56366,"noattachment":false,"key":"/rc-bullets/-/rc-bullets-1.5.12.tgz"},"maintainers":[{"name":"tristanyang","email":"yanggc888@gmail.com"}],"_npmUser":{"name":"tristanyang","email":"yanggc888@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rc-bullets_1.5.12_1591261491555_0.5640098837062333"},"_hasShrinkwrap":false,"readme":"# React 弹幕\n\n> 🌈 基于 CSS3 Animation，使用 React 构建，可扩展，高性能。\n\n[![NPM](https://img.shields.io/npm/v/rc-bullets.svg)](https://www.npmjs.com/package/rc-bullets) [![NPM downloads](https://img.shields.io/npm/dm/rc-bullets.svg)](http://npmjs.com/package/rc-bullets) [![twitter](https://img.shields.io/twitter/follow/wsygc?style=social)](https://twitter.com/wsygc)\n\n## 演示地址\n\n👉[zerosoul.github.io/rc-bullets/](https://zerosoul.github.io/rc-bullets/)\n\n![demo gif](demo.gif)\n\n## 安装\n\nnpm:\n\n```bash\nnpm install --save rc-bullets\n```\n\nyarn:\n\n```bash\nyarn add rc-bullets\n```\n\n## 初始化一个简单的弹幕场景\n\n```jsx\nimport React, { useEffect, useState } from 'react';\nimport BulletScreen, { StyledBullet } from 'rc-bullets';\n\nconst headUrl='https://zerosoul.github.io/rc-bullets/assets/img/heads/girl.jpg';\nexport default function Demo() {\n  // 弹幕屏幕\n  const [screen, setScreen] = useState(null);\n  // 弹幕内容\n  const [bullet, setBullet] = useState('');\n  useEffect(() => {\n    // 给页面中某个元素初始化弹幕屏幕，一般为一个大区块。此处的配置项全局生效\n    let s = new BulletScreen('.screen',{duration:20});\n    // or\n    // let s=new BulletScreen(document.querySelector('.screen));\n    setScreen(s);\n  }, []);\n  // 弹幕内容输入事件处理\n  const handleChange = ({ target: { value } }) => {\n    setBullet(value);\n  };\n  // 发送弹幕\n  const handleSend = () => {\n    if (bullet) {\n      // push 纯文本\n      screen.push(bullet);\n      // or 使用 StyledBullet\n\n      screen.push(\n        <StyledBullet\n          head={headUrl}\n          msg={bullet}\n          backgroundColor={'#fff'}\n          size='large'\n        />\n      );\n      // or 还可以这样使用，效果等同使用 StyledBullet 组件\n      screen.push({msg:bullet,head:headUrl,color:\"#eee\" size=\"large\" backgroundColor:\"rgba(2,2,2,.3)\"})\n    }\n  };\n  return (\n    <main>\n      <div className=\"screen\" style={{ width: '100vw', height: '80vh' }}></div>\n      <input value={bullet} onChange={handleChange} />\n      <button onClick={handleSend}>发送</button>\n    </main>\n  );\n}\n```\n\n## 特性\n\n- 支持传入 React 组件，灵活控制弹幕内容和 UI，并提供一个默认样式组件：`<StyledBullet/>`\n- 弹幕屏幕管理：清屏，暂停，隐藏（后续可能会加入针对单个弹幕的控制）\n- 弹幕动画参数化：运动函数（匀速/ease/步进/cubic-bezier）、时长（秒）、循环次数、延迟等\n- 鼠标悬浮弹幕暂停\n\n## 常用 API\n\n- 初始化弹幕屏幕：`const screen = new BulletScreen(<queryString>|<HTMLElement>,[<option>])`，此处的`option`和下面的一致，偏向全局初始化，没有则使用默认值，每次发送弹幕不传则使用默认或全局设置，传了则该条弹幕覆盖全局设置。\n- 发送弹幕：`const bulletId = screen.push(<string>|<ReactElement>,[<option>])`\n\n`option`：\n\n| 选项           | 含义               | 值类型        | 默认值      | 备注                                                                                                                      |\n| -------------- | ------------------ | ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- |\n| top            | 弹幕位置           | string        | undefined   | 自已强制定制距离顶部的高度，格式同 CSS 中的 top                                                                           |\n| trackHeight    | 轨道高度           | number        | 50          | 均分轨道的高度                                                                                                            |\n| onStart        | 自定义动画开始函数 | function      | null        | e.g.(bulletId,screen)=>{//do something}可以自定义一些动作，比如播放某个音效，在特定时间暂停该弹幕：screen.pause(bulletId) |\n| onEnd          | 自定义动画结束函数 | function      | null        | e.g.(bulletId,screen)=>{//do something}可以自定义一些动作，比如播放某个音效                                               |\n| pauseOnClick   | 鼠标点击暂停       | boolean       | false       | 再次点击继续                                                                                                              |\n| pauseOnHover   | 鼠标悬停暂停       | boolean       | true        | 鼠标进入暂停，离开继续                                                                                                    |\n| loopCount      | 循环次数           | number/string | 1           | 值为‘infinite’时，表示无限循环                                                                                            |\n| duration       | 滚动时长           | number/string | 10          | 数字则单位为‘秒’，字符串则支持'10s'和'300ms'两种单位                                                                      |\n| delay          | 延迟               | number/string | 0           | 数字则单位为‘秒’，字符串则支持'10s'和'300ms'两种单位                                                                      | [animation-delay](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-delay)支持的所有值 |\n| direction      | 动画方向           | string        | normal      | [animation-direction](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-direction)支持的所有值                   |\n| animateTimeFun | 动画函数           | string        | linear:匀速 | [animation-timing-function](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function)支持的所有值       |\n\n- 弹幕清屏：`screen.clear([<bulletId>])`，无参则清除全部\n- 暂停弹幕：`screen.pause([<bulletId>])`，无参则暂停全部\n- 弹幕继续：`screen.resume([<bulletId>])`，无参则继续全部\n- 隐藏弹幕（滚动继续）：`screen.hide([<bulletId>])`，无参则隐藏全部\n- 显示弹幕：`screen.show([<bulletId>])`，无参则显示全部\n- 自带的一个弹幕样式组件：`<StyledBullet msg=\"<弹幕内容>\" head=\"<头像地址>\" color=\"<字体颜色>\" backgroundColor=\"<背景色>\" size=\"<尺寸:small|normal|large|huge|自定义大小,基于em机制，默认normal>\">`\n\n## TO DO\n\n- ~~弹幕过多时，防重叠处理~~\n- react hooks 版本：`useBulletScreen`\n\n## 自己动手，丰衣足食\n\n### 克隆项目\n\n`git clone https://github.com/zerosoul/rc-bullets.git && cd rc-bullets`\n\n### 本地类库构建\n\n`npm i && npm run start`\n\n### 本地 demo\n\n`cd example && npm i && npm run start`\n\n## 支持\n\n![赞赏码](example/src/assets/img/reward.jpg)\n\n## License\n\nMIT © [zerosoul](https://github.com/zerosoul)\n","publish_time":1591261491664,"_cnpm_publish_time":1591261491664,"dist-tags":{"latest":"1.5.16"}}