# rafl

> request animation frame

Latest version **1.2.2** (published 2016-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install rafl
pnpm add rafl
yarn add rafl
bun add rafl
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2016-06-13 |
| First published | 2016-06-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Michael Rhodes |
| Maintainers | michaelrhodes |
| Keywords | animate, requestAnimationFrame, performance |

## Links

- npm: https://www.npmjs.com/package/rafl
- Repository: https://github.com/michaelrhodes/raf
- Homepage: https://github.com/michaelrhodes/raf#readme
- Issues: https://github.com/michaelrhodes/raf/issues
- npm.io page: https://npm.io/package/rafl

## Dependencies (1)

- [global](https://npm.io/package/global.md) ~4.3.0

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 1.2.2 (latest) — 2016-06-13
- 1.2.1 — 2016-06-07

## README

# rafl

A fork of the seemingly-abandoned [component/raf](https://github.com/component/raf) with added support for IE 11, web workers, and node.

[![Build status](https://travis-ci.org/michaelrhodes/rafl.svg?branch=master)](https://travis-ci.org/michaelrhodes/rafl)

## Install

```sh
$ npm install rafl
```

## Example

Request the animation frame with `raf(fn)`, cancel with `raf.cancel(id)`.

```js
var raf = require('rafl')

var x = 0
var y = 50
var canvas = document.querySelector('canvas')
var ctx = canvas.getContext('2d')

function animate() {
  raf(animate)
  draw()
}

var prev = Date.now()
function draw() {
  var curr = Date.now()
  var diff = curr - prev
  var p = diff / 16
  ctx.clearRect(0, 0, 900, 300)
  ctx.beginPath()
  ctx.globalAlpha = .5
  ctx.arc(x, y, 10, 0, Math.PI * 2, false)
  ctx.fill()
  x += 2
  y += Math.sin(x/20) * 5
  prev = curr
}

animate()
```

## Page weight (browserified)

| compression    |    size |
| :------------- | ------: |
| rafl.js        | 1.19 kB |
| rafl.min.js    |   865 B |
| rafl.min.js.gz |   449 B |


### License

[MIT](http://opensource.org/licenses/MIT)

---
_Source: https://npm.io/package/rafl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
