html5 弹幕引擎,Damoo: Damoo 是一个轻量级的 HTML5 弹幕引擎。可以在页面元素上附加一层弹幕图层并且以非常简单的 API 调用方式使用。...

本文介绍了Damoo,一个轻量级的HTML5弹幕引擎,用于在网页上实现弹幕效果。通过下载最新版本,引入JS文件并设置容器,可以轻松初始化和运行弹幕。此外,还提供了如何发射、定制样式、控制弹幕及暂停恢复的示例代码,是前端开发者实现互动弹幕功能的好帮手。
摘要由CSDN通过智能技术生成

Damoo Join%20Chat.svg

An HTML5 Danmaku Engine.

一个不起眼的 HTML5 弹幕引擎。

Getting started 走起

Download the latest release.

下载最新发行版本。

Damoo requires a complete DOM with a suitable container to be fit in.

需要在页面中准备一个合适的容器。

Then, import damoo.js or damoo.min.js.

然后引入damoo.js或damoo.min.js。

Initiate Damoo.

初始化。

var damoo = Damoo('dm-screen', 'dm-canvas', 20);

Or use your own font instead of "sans-serif".

可自定义全局字体。

var damoo = Damoo('dm-screen', 'dm-canvas', 20, "Arial");

And run it.

运行。

damoo.start();

Danmaku can be emitted by calling emit method.

用emit方法发射弹幕。

damoo.emit({ text: "Damoo is awesome!", color: "#f49" });

Enable text shadow.

开启字体阴影。

damoo.emit({ text: "I got a shadow!", color: "#000", shadow: true });

Color the shadow.

自定义阴影颜色。

damoo.emit({ text: "Hooray!", color: "#f00", shadow: { color: "#f49" } });

Danmaku can also be fixed at the center of the screen.

发射固定弹幕。

damoo.emit({ text: "I'M FIXED!", color: "#6f9", fixed: true });

Clear the screen.

清空屏幕。

damoo.clear();

You may hide Damoo.

隐藏弹幕图层。

damoo.hide();

And bring it back.

显示弹幕图层。

damoo.show();

If needed, you may suspend the animation.

暂停动画。

damoo.suspend();

And resume it when ready to go.

恢复动画。

damoo.resume();

Contributing 填坑

Hope you enjoy the code!

你们城里人都很会玩,我就不多说了。

_(:з」∠)_

Send Pull Requests to contribute!

License 许可协议

Damoo.svg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值