0.0.19 • Published 7 years ago

biujs v0.0.19

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

biu.js

一个弹幕js.🔫

How to use

In a browser:

<script src="biu.min.js"></script>
var anime = new Biu.anime();
var biu = new Biu({
  name: 'biubiu',
  socket: location.protocol + '//' + location.hostname + (location.port ? ':'+location.port : '') ,
  onMessage:(data)=>{
    anime.run(data)
  }
});

Using npm:

npm i --save biujs
import Biu from 'biujs';

var anime = new Biu.anime();
var biu = new Biu({
  name: 'biubiu',
  socket: location.protocol + '//' + location.hostname + (location.port ? ':'+location.port : '') ,
  onMessage:(data)=>{
    anime.run(data)
  }
});

Biu 用来接收服务端消息,Biu.anime 是一个动画扩展,你可以直接使用,如果不满足你的需求,也可以在 onMessage 里自己写。

Biu

配置项

name:在服务端申请的项目名称,实际对应 socket.io 中的一个 namespace

socket:服务端地址

onConnect:连接成功时的回调

onMessage:接收消息时的回调

方法

open:连接ws,实例化时自动调用

stop:关闭

send:发送消息,接收 string 或者 object 的参数,object时一定要有text字段(弹幕内容)

Biu.anime

colors:弹幕颜色,接收一个数组,默认值:'#f55b15', '#764ba5', '#00a762', '#0193e6', '#e0463c'

maxDuration:弹幕最大时间

minDuration:弹幕最小时间(每个弹幕会在最大最小时间中取一个随机值)

方法

run:显示弹幕

show:显示

hide:隐藏

0.0.19

7 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago