Chuyue0 / damoo

Lightweight HTML5 Canvas Danmaku Engine

Home Page:https://damoo.jamesliu.info

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Damoo

Lightweight Canvas HTML5 Danmaku Engine.

Damoo

Youtube extension

Click to see Damoo extension script for YouTube live chat.

Getting started

Use Bower .

$ bower install damoo

Damoo will be installed to bower_components/ directory.

Or download the latest release.

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

<div id="dm-main">
    <div id="dm-screen"></div>
</div>

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

<script type="text/javascript" src="damoo.min.js"></script>

Initiate Damoo.

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

Or by binding an element.

var damoo = new Damoo(document.getElementById('dm-screen'), 'dm-canvas', 20);

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

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

And run it.

damoo.play();

Danmaku can be emitted by calling emit method.

// Simple
damoo.emit("Damoo is awesome!");

// With attributes
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 pause the animation.

damoo.pause();

And resume it when ready to go.

damoo.resume();

Hope you enjoy the code!

Contributing

Send Pull Requests to contribute!

License

MIT License

About

Lightweight HTML5 Canvas Danmaku Engine

https://damoo.jamesliu.info

License:MIT License


Languages

Language:JavaScript 100.0%