1.0.2 • Published 5 years ago

bullet-screen v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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

AttributeDescriptionDefault
idplaceholdernone
speedspeed2
colordefault text color#000
sizedefault text size16
gapdefault gap between text4

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