轮子地址:https://github.com/hugeorange/BulletJs
API
option:
| 选项 | 含义 | 值类型 | 默认值 | 备注 | |
|---|---|---|---|---|---|
| trackHeight | 轨道高度 | string | 50px | 均分轨道的高度 | |
| onStart | 自定义动画开始函数 | function | null | 开始开始回调 | |
| onEnd | 自定义动画结束函数 | function | null | 弹幕运动结束回调 | |
| pauseOnClick | 鼠标点击暂停 | boolean | false | 再次点击继续 | |
| pauseOnHover | 鼠标悬停暂停 | boolean | true | 鼠标进入暂停,离开继续 | |
| duration | 滚动时长 | string | 10s | 传入speed该参数无效 | |
| speed | 滚动速度 | number | 100 | 100px/s | null |
- 暂停弹幕:
screen.pause([<bulletId>]),无参则暂停全部 - 弹幕继续:
screen.resume([<bulletId>]),无参则继续全部
弹幕防重叠原理

