# cl-bullets

> 弹幕组件

Latest version **0.0.3** (published 2018-06-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install cl-bullets
pnpm add cl-bullets
yarn add cl-bullets
bun add cl-bullets
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2018-06-19 |
| First published | 2018-05-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 88.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jiangjy |
| Maintainers | jiangjy |
| Keywords | bullet, barrage, vue, react |

## Links

- npm: https://www.npmjs.com/package/cl-bullets
- Repository: https://github.com/chelun-h5/bullets
- Homepage: https://github.com/chelun-h5/bullets#readme
- Issues: https://github.com/chelun-h5/bullets/issues
- npm.io page: https://npm.io/package/cl-bullets

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^16.3.1
- [react-dom](https://npm.io/package/react-dom.md) ^16.3.1
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2018-06-19
- 0.0.2 — 2018-05-14
- 0.0.1 — 2018-05-14

## README

# bullets
弹幕组件

![image](https://raw.githubusercontent.com/chelun-h5/bullets/master/doc/bullets.png)

## 安装

```
yarn add cl-bullets
```
或

```
npm i cl-bullets --save
```

## React组件

React组件有默认导出，所以组件名字任意，以下代码作为示例

```
// 导入
import Bullets from 'cl-bullets';

// 使用 
<Bullets ref={(ref)=>{this.bullets = ref}} width={375} height={300} fontSize={12} area={0.5} speed={[1,2]} />
//一条弹幕的格式
this.bullets.add({
    logo: "", 
    text: "我是一条弹幕",
    textColor: "#ffff00",
    background: "rgba(0,0,0,0.3)",
    loop: true,
    border:{
        size: 1,
        color: "red"
    }
});
//or 添加多条弹幕
this.bullets.add([{
    logo: "", 
    text: "我是一条弹幕",
    textColor: "#ffff00",
    background: "rgba(0,0,0,0.3)",
    loop: true,
    border:{
        size: 1,
        color: "red"
    }
}]);
//开始滚动
this.bullets.start()
//停止滚动
this.bullets.stop();
//清空画布
this.bullets.clear();
```

## Vue组件

```
待开发
```

## 属性说明


属性 | 值 | 说明
---|---|---
width | 必填；数字；| 宽度
height | 必填；数字；| 高度
fontSize | 必填；数字；| 弹幕中字体大小
area | 必填；数字；| 0-1 弹幕的区域，从顶部开始计算
speed | 选填；数组 | [min,max] 每帧移动位置，单位像素，一帧约16.67毫秒，默认[1,2]

---
_Source: https://npm.io/package/cl-bullets · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
