{"analyzedAt":"2022-06-27T08:17:28.160Z","collected":{"metadata":{"name":"timaline","scope":"unscoped","version":"0.0.22","description":"timaline is a requestAnimationFrame based tasks scheduler.","keywords":["timing","timer","setTimeout","timeout","tasks","timeline","RAF","RequestAnimationFrame","schedule","speed","repeat"],"date":"2018-01-26T15:31:31.287Z","author":{"name":"Kevin Boudot","email":"kevin.boudot@gmail.com","url":"http://www.kevinboudot.me/","username":"kevinboudot"},"publisher":{"username":"kevinboudot","email":"kevin.boudot@gmail.com"},"maintainers":[{"username":"kevinboudot","email":"kevin.boudot@gmail.com"}],"repository":{"type":"git","url":"git+https://github.com/kevinboudot/timaline.git"},"links":{"npm":"https://www.npmjs.com/package/timaline","homepage":"https://github.com/kevinboudot/timaline#readme","repository":"https://github.com/kevinboudot/timaline","bugs":"https://github.com/kevinboudot/timaline/issues"},"license":"MIT","dependencies":{"raf":"^3.4.0"},"releases":[{"from":"2022-05-28T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2022-03-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2021-12-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2021-06-27T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2020-06-27T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0}],"readme":"# timaline\n\nTimaline is a requestAnimationFrame based tasks scheduler.\n\n* [To Do](#to-do)\n* [Installation](#installation)\n* [Features](#features)\n* [Browser compatibility](#browser-compatibility)\n* [Documentation](#documentation)\n\t* [Use](#use)\n\t* [Options](#options)\n\t* [Methods](#methods)\n\t* [Informations](#informations)\n* [Examples](#examples)\n\t* [Simple task](#simple-task)\n\t* [Chained tasks](#chained-tasks)\n\t* [Shortcuts use](#shortcuts-use)\n\t* [Update manually](#update-manually)\n\t* [Destroy on the fly](#destroy-on-the-fly)\n\n### To Do\n\n- [x] Reduce RAF Delta impact by \"prev or next\" frame\n- [x] Speed\n- [x] Repeat\n- [x] User custom loop (manually update)\n- [x] Disable RAF when web page is not active\n- [ ] Playback control\n- [ ] RAF Delta impact reducing by average calculation\n- [ ] Reduce RAF Delta aftereffect\n\n### Installation\n\n[![NPM](https://nodei.co/npm/Timaline.png?mini=true)](https://www.npmjs.com/package/timaline>)\n\n### Demo\n\n[Test timaline in your browser](https://tonicdev.com/npm/timaline)\n\n### Features\n\n- Set callback functions\n- Wait time in millisecond\n- AddClass to a node\n- RemoveClass to a node\n- Destroy everything\n- Control speed\n- Control repeat\n- Update manually\n- Pause when tab is not visible\n\n### Browser compatibility\n\nIE 10+\n\n## Documentation\n\n### Use\n\n```js\nvar Timaline = require('Timaline');\n````\n\n### Options\n\nYou can pass 3 options to constructor, and you can combine them :\n\n```js\n\nvar timeline = new Timaline({\n\tloop: false, // default : true\n\tspeed: 0.5, // default : 1\n\trepeat: 3 // default : 0\n});\n```\n\n### Methods\n\n#### .wait(time)\n\nWait time.\n\n##### properties\n\n###### `time` (`Integer`)\n\nTime to wait in millisecond\n\n#### .set(callback)\n\nCall your function.\n\n##### properties\n\n###### `callback` (`Function`)\n\nThe fonction you need to call\n\n#### .addClass(el, classname)\n\nAddClass shortcut.\n\n##### properties\n\n###### `el` (`Node`)\n\nYour dom element\n\n###### `classname` (`String`)\n\nYour class name\n\n#### .removeClass(el, classname)\n\nRemoveClass shortcut.\n\n##### properties\n\n###### `el` (`Node`)\n\nYour dom element\n\n###### `classname` (`String`)\n\nYour class name\n\n#### .destroy()\n\nRoughly destroy your timeline.\n\n###### `speed` (`Float`)\n\nSpeed will control entire timeline (default: 1)\n\n###### `repeat` (`Float`)\n\nRepeat your timeline as many times as you like (default: 0)\n\n### Informations\n\nWhen you set a callback, infos are available :\n\n```js\nvar delay = new Timaline();\n\ndelay\n\t.wait(200)\n\t\t.set(function(infos){\n\t\t\tconsole.log(infos);\n\t\t});\n```\n\n```js\nvar infos = {\n\tindex: 2, // The index of your task\n\tkeyframe: {\n\t\tforecast: 3000, // Time forecast by set wait time\n\t\treal: 2996, // Real time (with RAF Delta)\n\t\tshift:  -4 // Shift between both\n\t}\n};\n```\n\n\n### Examples\n\n#### Simple task\n\nThis example is a simple delayed task, similar as a simple window.setTimeout :\n\n```js\nvar delay = new Timaline();\n\ndelay\n\t.wait(200)\n\t\t.set(function(infos){\n\t\t\tconsole.log(infos);\n\t\t});\n```\n\n#### Chained tasks\n\nThis example is a chained tasks :\n\n```js\nvar timeline = new Timaline();\n\ntimeline\n\t.wait(1000)\n\t\t.set(function(infos){\n\t\t\tconsole.log('task index :' + infos.index );\n\t\t})\n\t.wait(2000)\n\t\t.set(function(infos){\n\t\t\tconsole.log('task index :' + infos.index );\n\t\t});\n```\n\n#### Shortcuts use\n\nIf you need, you can use shortcuts methods during your timeline :\n(consider that the used classes exist in your stylesheet)\n\n```js\nvar $header = document.getElementById('header');\nvar $container = document.getElementById('container');\nvar $footer = document.getElementById('footer');\n\nvar hidePage = new Timaline();\n\nhidePage\n\t.set(function(infos){\n\t\tconsole.log('This page will disappear in a while.');\n\t})\n\t.wait(1000)\n\t\t.addClass($header, 'fadeOut')\n\t.wait(800)\n\t\t.removeClass($container, 'shown')\n\t.wait(1000)\n\t\t.addClass($footer, 'scaleOut')\n\t.set(function(infos){\n\t\tconsole.log('That\\'s all folks!');\n\t});\n```\n\n#### Update manually\n\nThis example show how to update Timaline with your own loop :\n\n```js\nvar delay = new Timaline({\n\traf: false\n});\n\nfunction loop( timestamp ) {\n\tdelay.update( timestamp );\n\trequestAnimationFrame( loop );\n}\n\nrequestAnimationFrame( loop );\n\ndelay\n\t.wait(200)\n\t\t.set(function(infos){\n\t\t\tconsole.log(infos);\n\t\t});\n```\n\n#### Destroy on the fly\n\nA timeline is destructs when it is finished, but sometimes you need to roughly destroy it before the end :\n\n```js\n// Create a new timeline\n\nvar timeline = new Timaline();\n\ntimeline\n\t.wait(3000)\n\t.set(function(infos){\n\t\tconsole.log('I\\'ll never be call.');\n\t})\n\t.wait(1000)\n\t.set(function(infos){\n\t\tconsole.log('me too.');\n\t});\n\n// ..and create a new one that will remove\n// the first one before its end\n\nvar destroy = new Timaline();\n\ndestroy\n\t.wait(1000)\n\t.set(function(infos){\n\t\ttimeline.destroy();\n\t});\n```"},"npm":{"downloads":[{"from":"2022-06-26T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2022-06-20T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":1},{"from":"2022-05-28T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":9},{"from":"2022-03-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":76},{"from":"2021-12-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":130},{"from":"2021-06-27T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":307}],"starsCount":0},"github":{"starsCount":12,"forksCount":1,"subscribersCount":1,"issues":{"count":0,"openCount":0,"distribution":{"3600":0,"10800":0,"32400":0,"97200":0,"291600":0,"874800":0,"2624400":0,"7873200":0,"23619600":0,"70858800":0,"212576400":0},"isDisabled":false},"contributors":[{"username":"kevinboudot","commitsCount":11}],"commits":[{"from":"2022-06-20T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2022-05-28T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2022-03-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2021-12-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2021-06-27T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0}]},"source":{"files":{"readmeSize":4733,"testsSize":0},"badges":[{"urls":{"original":"https://nodei.co/npm/Timaline.png?mini=true","shields":"https://img.shields.io/npm/v/Timaline.svg","content":"https://img.shields.io/npm/v/Timaline.json"},"info":{"service":"npm","type":"version"}}]}},"evaluation":{"quality":{"carefulness":0.355,"tests":0,"health":1,"branding":0.15},"popularity":{"communityInterest":15,"downloadsCount":25.333333333333332,"downloadsAcceleration":-0.1649923896499239,"dependentsCount":0},"maintenance":{"releasesFrequency":0,"commitsFrequency":0,"openIssues":0.7,"issuesDistribution":0.7}},"score":{"final":0.45705453424834563,"detail":{"quality":0.49929412945139323,"popularity":0.047809996291577915,"maintenance":0.8300937048882155}}}