tikk v1.0.2
Tikk
Animation with requestAnimationFrame, inspired by nm8
Installation
Node.js
npm install tikk --save
Browser
Local
<script src="node_modules/tikk/dist/tikk.min.js"></script>
CDN unpkg
<script src="https://unpkg.com/tikk/dist/tikk.min.js"></script>
Example
const Tikk = require('tikk');
// create animation
const anim = new Tikk((value, elapsed) => {
console.log(value, elapsed);
}, 2000)
.on('play', () => {
console.log('play')
})
.on('pause', (elapsed) => {
console.log('pause', 'at', elapsed)
})
.on('stop', (elapsed) => {
console.log('stop', 'at', elapsed)
});
// play animation
anim.play();
// pause animation
anim.pause();
// stop animation
anim.stop();
Tikk
Kind: global class
- Tikk
- new Tikk(handler, duration)
- instance
- inner
- ~handler : function
new Tikk(handler, duration)
Create instance
tikk.play() ⇒ Tikk
Play animation
Kind: instance method of Tikk
tikk.pause() ⇒ Tikk
Pause animation
Kind: instance method of Tikk
tikk.stop() ⇒ Tikk
Stop animation
Kind: instance method of Tikk
tikk.getState() ⇒ string
Returns state can be play, pause, stop
Kind: instance method of Tikk
tikk.on(eventName, callback) ⇒ Tikk
Add event
Kind: instance method of Tikk
tikk.suspendEvent(...eventName) ⇒ Tikk
Suspends firing of the named event(s).
Kind: instance method of Tikk
tikk.resumeEvent(...eventName) ⇒ Tikk
Resumes firing of the named event(s).
Kind: instance method of Tikk
tikk.suspendEvents() ⇒ Tikk
Suspends all events.
Kind: instance method of Tikk
tikk.resumeEvents() ⇒ Tikk
Resume all events.
Kind: instance method of Tikk
"play"
Triggered at play
Kind: event emitted by Tikk
"pause" (elapsed)
Triggered at pause
Kind: event emitted by Tikk
"stop" (elapsed)
Triggered at stop
Kind: event emitted by Tikk
Tikk~handler : function
Tikk handler
Kind: inner typedef of Tikk
Properties
Changelog
You can view the changelog here
License
Tikk is open-sourced software licensed under the MIT license
Author
Fabio Ricali