hugeorange / Bulletjs
👨💻一个原生js弹幕库
Stars: ✭ 22
Programming Languages
typescript
32286 projects
Labels
Projects that are alternatives of or similar to Bulletjs
Danmu Server
A danmaku server based on WebSocket. 弹幕服务器,基于WebSocket。
Stars: ✭ 169 (+668.18%)
Mutual labels: danmu
Danmaku
A high-performance JavaScript danmaku engine. 高性能弹幕引擎库
Stars: ✭ 446 (+1927.27%)
Mutual labels: danmu
Ocbarrage
iOS 弹幕库 OCBarrage, 同时渲染5000条弹幕也不卡, 轻量, 可拓展, 高度自定义动画, 超高性能, 简单易上手; A barrage render-engine with high performance for iOS. At the same time, rendering 5000 barrages is also very smooth, lightweight, scalable, highly custom animation, ultra high performance, simple and easy to use!
Stars: ✭ 294 (+1236.36%)
Mutual labels: danmu
Real Url
获取斗鱼&虎牙&哔哩哔哩&抖音&快手等 58 个直播平台的真实流媒体地址(直播源)和弹幕,直播源可在 PotPlayer、flv.js 等播放器中播放。
Stars: ✭ 3,748 (+16936.36%)
Mutual labels: danmu
DouyuBarrage-Pro
(2020年最新)斗鱼弹幕抓取及可视化管理平台第二版,提供弹幕抓取、弹幕实时发送速度可视化、抓取记录查询、弹幕下载、自定义关键词统计、铁粉统计、高光时刻自动捕获、高频弹幕词云等功能,起飞~~~
Stars: ✭ 139 (+531.82%)
Mutual labels: danmu
Kikoplay
KikoPlay - NOT ONLY A Full-Featured Danmu Player 不仅仅是全功能弹幕播放器
Stars: ✭ 313 (+1322.73%)
Mutual labels: danmu
Bili
A tool to download barrage/video from bilibili/acfun. Support English, Japanese and Chinese(China).一个Python编写的从Bilibili/Acfun下载弹幕/视频的工具。支持英语、日语和中文(中国)。(WEBGUI正在路上)
Stars: ✭ 179 (+713.64%)
Mutual labels: danmu
Artplayer
🎨 ArtPlayer.js is a modern and full featured HTML5 video player
Stars: ✭ 484 (+2100%)
Mutual labels: danmu
Danmu Client
A cross-platforms danmaku client that supports transparency which based on canvas + WebSocket. 多用跨平台透明弹幕客户端,支持图文弹幕,基于canvas + WebSocket。
Stars: ✭ 151 (+586.36%)
Mutual labels: danmu
Ocbarrage
iOS 弹幕库 OCBarrage, 同时渲染5000条弹幕也不卡, 轻量, 可拓展, 高度自定义动画, 超高性能, 简单易上手; A barrage render-engine with high performance for iOS. At the same time, rendering 5000 barrages is also very smooth, lightweight, scalable, highly custom animation, ultra high performance, simple and easy to use!
Stars: ✭ 589 (+2577.27%)
Mutual labels: danmu
BulletJs
😀一个原生js弹幕库,基于 CSS3 Animation
- segmentFault文章地址
- 项目地址
- 本项目灵感来源于 rc-bullets
-
演示页面
https://hugeorange.github.io/gh-pages/bullets/index
- 演示图
更新日志
2021-01-22更新
- 全局增加
isAllPaused
标志,当全部暂停后不会再有push或是render,resume
之后即可恢复 - 问题:
切记:不可覆盖内部样式类 bullet-item-style
否则可能会出现弹幕重叠问题 - 增加演示页面
2020-08-24更新
- 源码采用ts书写,增加
.d.ts
文件 - 采用rollup打包并发布到npm,rollup打包教程
- 去除靠
IntersectionObserver
来对弹道进行调度,采用新的弹道选择算法,增加防重叠检测 - 支持同速/不同速弹幕
- 默认情况下直接丢弃排不上对的弹幕,不对其进行缓存,对于必定要上墙的弹幕在push时可以增加一个参数
this.screen.push(danmu, {}, true)
(适用于用户自己发的弹幕,需要将第三个参数传为true
) - 变更名字,想想用拼音起名还是太low了😂😂😂
使用方式
-
直接cdn引入
// 示例代码: https://github.com/hugeorange/BulletJs/blob/master/src/index.html <script src="https://unpkg.com/[email protected]/dist/BulletJs.min.js"></script> <script> const screen = new BulletJs('.screen', { trackHeight: 35 }); </script>
-
ESModule 引入
yarn add js-bullets // react import BulletJs from "js-bullets"; componentDidMount() { this.screen = new BulletJs("#danmu-screen", {}) setInterval(() => { this.screen.push('<span>12222222</span>') }, 1000) }
-
简单粗暴的办法直接拷贝
comps
目录下的代码到你的项目中使用,vue、react项目均可
- 项目产生原因:
- 因为
rc-bullets
是基于React
,可能很多使用其他框架的同学没法使用 - 新增了
speed
参数,让所有弹幕以相同速度运动(自己项目的需要) - 在
animationEnd
的时候增加了轨道置空处理 - 对
queues
队列的处理方式不同 - 弹幕格式
dom 字符串
- 去掉了一些自己项目用不到的 api
- 因为
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 传入null 会根据 duration 参数自动控制速度,弹幕越长速度越快 |
- 暂停弹幕:
screen.pause([<bulletId>])
,无参则暂停全部 - 弹幕继续:
screen.resume([<bulletId>])
,无参则继续全部
注意事项
-
弹幕原理:利用
css3 animation 关键帧动画
, 从左移动到右,duration
控制速度@keyframe name { from { transform: translateX(width px) } to { transform: translateX(-100%) } }
-
另外一点需要注意的:我在项目里从接口里读出来数据每页20条,每隔 1s 去发一条弹幕(用 setTimeout),这时有个问题,当页面休眠休眠时,会出现setTimeout堆积的情况,解决办法:用 requestAnimationFrame替代 setTimeout
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].