{"_id":"rafl","_rev":"2840274","name":"rafl","description":"request animation frame","dist-tags":{"latest":"1.2.2"},"maintainers":[{"name":"michaelrhodes","email":"spam@michaelrhod.es"}],"time":{"modified":"2022-09-06T15:51:10.000Z","created":"2016-06-07T20:14:32.291Z","1.2.2":"2016-06-13T20:39:55.630Z","1.2.1":"2016-06-07T20:14:32.291Z"},"users":{},"author":{"name":"Michael Rhodes"},"repository":{"type":"git","url":"git+https://github.com/michaelrhodes/raf.git"},"versions":{"1.2.2":{"name":"rafl","description":"request animation frame","version":"1.2.2","keywords":["animate","requestAnimationFrame","performance"],"main":"index.js","dependencies":{"global":"~4.3.0"},"devDependencies":{"tape":"~4.5.1"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js"},"repository":{"type":"git","url":"git+https://github.com/michaelrhodes/raf.git"},"author":{"name":"Michael Rhodes"},"license":"MIT","gitHead":"932c06d782648c7ff4ef1622bdfa56ac94a4592e","bugs":{"url":"https://github.com/michaelrhodes/raf/issues"},"homepage":"https://github.com/michaelrhodes/raf#readme","_id":"rafl@1.2.2","_shasum":"fe930f758211020d47e38815f5196a8be4150740","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.0","_npmUser":{"name":"michaelrhodes","email":"spam@michaelrhod.es"},"dist":{"shasum":"fe930f758211020d47e38815f5196a8be4150740","size":1495,"noattachment":false,"key":"/rafl/-/rafl-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/rafl/download/rafl-1.2.2.tgz"},"maintainers":[{"name":"michaelrhodes","email":"spam@michaelrhod.es"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/rafl-1.2.2.tgz_1465850394984_0.7766697437036783"},"directories":{},"publish_time":1465850395630,"_hasShrinkwrap":false,"_cnpm_publish_time":1465850395630,"_cnpmcore_publish_time":"2021-12-16T11:29:07.134Z"},"1.2.1":{"name":"rafl","description":"request animation frame","version":"1.2.1","keywords":["animate","requestAnimationFrame","performance"],"main":"index.js","devDependencies":{"tape":"~4.5.1"},"scripts":{"test":"tape test.js"},"testling":{"files":"test.js"},"repository":{"type":"git","url":"git+https://github.com/michaelrhodes/raf.git"},"author":{"name":"Michael Rhodes"},"license":"MIT","gitHead":"7cbb3efae70183ca9862fa4188ff2a163168ea51","bugs":{"url":"https://github.com/michaelrhodes/raf/issues"},"homepage":"https://github.com/michaelrhodes/raf#readme","_id":"rafl@1.2.1","_shasum":"45912dacab34789d3b69590623dd5f4f49bdecd6","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.0","_npmUser":{"name":"michaelrhodes","email":"spam@michaelrhod.es"},"dist":{"shasum":"45912dacab34789d3b69590623dd5f4f49bdecd6","size":1483,"noattachment":false,"key":"/rafl/-/rafl-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/rafl/download/rafl-1.2.1.tgz"},"maintainers":[{"name":"michaelrhodes","email":"spam@michaelrhod.es"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/rafl-1.2.1.tgz_1465330471780_0.5691541326232255"},"directories":{},"publish_time":1465330472291,"_hasShrinkwrap":false,"_cnpm_publish_time":1465330472291,"_cnpmcore_publish_time":"2021-12-16T11:29:07.315Z"}},"readme":"# rafl\n\nA fork of the seemingly-abandoned [component/raf](https://github.com/component/raf) with added support for IE 11, web workers, and node.\n\n[![Build status](https://travis-ci.org/michaelrhodes/rafl.svg?branch=master)](https://travis-ci.org/michaelrhodes/rafl)\n\n## Install\n\n```sh\n$ npm install rafl\n```\n\n## Example\n\nRequest the animation frame with `raf(fn)`, cancel with `raf.cancel(id)`.\n\n```js\nvar raf = require('rafl')\n\nvar x = 0\nvar y = 50\nvar canvas = document.querySelector('canvas')\nvar ctx = canvas.getContext('2d')\n\nfunction animate() {\n  raf(animate)\n  draw()\n}\n\nvar prev = Date.now()\nfunction draw() {\n  var curr = Date.now()\n  var diff = curr - prev\n  var p = diff / 16\n  ctx.clearRect(0, 0, 900, 300)\n  ctx.beginPath()\n  ctx.globalAlpha = .5\n  ctx.arc(x, y, 10, 0, Math.PI * 2, false)\n  ctx.fill()\n  x += 2\n  y += Math.sin(x/20) * 5\n  prev = curr\n}\n\nanimate()\n```\n\n## Page weight (browserified)\n\n| compression    |    size |\n| :------------- | ------: |\n| rafl.js        | 1.19 kB |\n| rafl.min.js    |   865 B |\n| rafl.min.js.gz |   449 B |\n\n\n### License\n\n[MIT](http://opensource.org/licenses/MIT)\n","_attachments":{},"homepage":"https://github.com/michaelrhodes/raf#readme","bugs":{"url":"https://github.com/michaelrhodes/raf/issues"},"license":"MIT"}