Numerous Problems Multiplied
Miss any of our Open RFC calls?Watch the recordings here! »

tikk

1.0.2 • Public • Published

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

new Tikk(handler, duration)

Create instance

ParamTypeDefault
handlerhandler
durationnumber0

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

ParamTypeDescription
eventNamestring

event name

callbackfunction

callback

tikk.suspendEvent(...eventName) ⇒ Tikk

Suspends firing of the named event(s).

Kind: instance method of Tikk

ParamTypeDescription
...eventNamestring

multiple event names to suspend

tikk.resumeEvent(...eventName) ⇒ Tikk

Resumes firing of the named event(s).

Kind: instance method of Tikk

ParamTypeDescription
...eventNamestring

multiple event names to resume.

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

ParamType
elapsednumber

"stop" (elapsed)

Triggered at stop

Kind: event emitted by Tikk

ParamType
elapsednumber

Tikk~handler : function

Tikk handler

Kind: inner typedef of Tikk
Properties

NameTypeDescription
valuenumber

can be offset between 0 and 1 if duration is specified or delta (in ms) if no duration is specified. Usually 16 or 17

elapsednumber

elapsed time

Changelog

You can view the changelog here

License

Tikk is open-sourced software licensed under the MIT license

Author

Fabio Ricali

Install

npm i tikk

DownloadsWeekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

85.9 kB

Total Files

9

Last publish

Collaborators

  • avatar