Tikk
Animation with requestAnimationFrame, inspired by nm8
Installation
Node.js
npm install tikk --save
Browser
Local
CDN unpkg
Example
const Tikk = ; // create animationconst anim = { console;} 2000; // play animationanim; // pause animationanim; // stop animationanim;
Tikk
Kind: global class
- Tikk
- new Tikk(handler, duration)
- instance
- inner
- ~handler :
function
- ~handler :
new Tikk(handler, duration)
Create instance
Param | Type | Default |
---|---|---|
handler | handler | |
duration | number | 0 |
Tikk
tikk.play() ⇒ Play animation
Kind: instance method of Tikk
Tikk
tikk.pause() ⇒ Pause animation
Kind: instance method of Tikk
Tikk
tikk.stop() ⇒ Stop animation
Kind: instance method of Tikk
string
tikk.getState() ⇒ Returns state can be play, pause, stop
Kind: instance method of Tikk
Tikk
tikk.on(eventName, callback) ⇒ Add event
Kind: instance method of Tikk
Param | Type | Description |
---|---|---|
eventName | string | event name |
callback | function | callback |
Tikk
tikk.suspendEvent(...eventName) ⇒ Suspends firing of the named event(s).
Kind: instance method of Tikk
Param | Type | Description |
---|---|---|
...eventName | string | multiple event names to suspend |
Tikk
tikk.resumeEvent(...eventName) ⇒ Resumes firing of the named event(s).
Kind: instance method of Tikk
Param | Type | Description |
---|---|---|
...eventName | string | multiple event names to resume. |
Tikk
tikk.suspendEvents() ⇒ Suspends all events.
Kind: instance method of Tikk
Tikk
tikk.resumeEvents() ⇒ 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
Param | Type |
---|---|
elapsed | number |
"stop" (elapsed)
Triggered at stop
Kind: event emitted by Tikk
Param | Type |
---|---|
elapsed | number |
function
Tikk~handler : Tikk handler
Kind: inner typedef of Tikk
Properties
Name | Type | Description |
---|---|---|
value | number | can be offset between 0 and 1 if duration is specified or delta (in ms) if no duration is specified. Usually 16 or 17 |
elapsed | number | elapsed time |
Changelog
You can view the changelog here
License
Tikk is open-sourced software licensed under the MIT license