bilibala
v0.1.0
Published
A interesting typing animation plugin
Downloads
2
Readme
A simple but powerful typewriting animation plugin written by ES6
👉Not only support typing and backspace, but also support moving cursor and adding css style
ShowCase 😲
Usage 🔨
step1. init a animate instance
- using in es6
import Bilibala from 'bilibala'
var instance = new Bilibala(element, [text], [options])
- use in browser
<div id="container"></div>
<script src="/path/bilibala.js"></script>
<script>
window.onload = function () {
const container = document.getElementById('container')
new Bilibala(container, [text], [options])
}
</script>
step2. typing ,backspace...
typing
// it will type a character in 80ms instance.type('hello', { speed: 80 })
backspace
instance.backspace(10, [options])
moving cursor
// move backward instance.move(-10) // move forward instance.move(10)
wait
// cursor will wait for 3000ms instance.wait(3000)
add css style when typing
instance.type('add style', { style: { color: 'red' } })
change the element type when typing
instance.type('github', { tag: 'a', attrs: { href: 'github.com' } })