bullet-screen

1.0.2 • Public • Published

bulletScreen

GitHub license

bulletScreen based on canvas

Links

Install

npm install bullet-screen

or

<script src="https://cdn.jsdelivr.net/npm/bullet-screen@latest/dist/bulletScreen.js"></script>

Usage

<!-- this div need set width and height (inline or css) -->
<div id="app" style="position: relative; width: 800px; height: 600px"></div>
import BulletScreen from 'bullet-screen'
 
const bullet = new BulletScreen({id: "app"})
// send
bullet.push('test')
bullet.push('test', 'color')
bullet.push('test', 'static')

Constructor

Attribute Description Default
id placeholder none
speed speed 2
color default text color #000
size default text size 16
gap default gap between text 4

API

  • run: bullet.run()
  • stop: bullet.stop()
  • send: type default / color / static bullet.push(text, type)

EVENT

bullet.on('fps', (times) => {
    // render ${times} fps per/seconds
})

Example

示例

PS

如果喜欢请给个星星,谢谢。 If you like, please give me a star, thank you.

如果需要帮助: QQ:1573815240 邮箱: 1573815240@qq.com if you need help: QQ:1573815240 email: 1573815240@qq.com

Package Sidebar

Install

npm i bullet-screen

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

235 kB

Total Files

8

Last publish

Collaborators

  • coolapt