# request-animation-loop

> setInterval is to setTimeout as requestAnimationLoop is to requestAnimationFrame.

Latest version **0.1.0** (published 2015-07-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install request-animation-loop
pnpm add request-animation-loop
yarn add request-animation-loop
bun add request-animation-loop
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-07-01 |
| First published | 2015-07-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ola Holmström |
| Maintainers | olahol |
| Keywords | requestAnimationFrame, browser, animation, setInterval |

## Links

- npm: https://www.npmjs.com/package/request-animation-loop
- Repository: https://github.com/olahol/request-animation-loop
- Homepage: https://github.com/olahol/request-animation-loop#readme
- Issues: https://github.com/olahol/request-animation-loop/issues
- npm.io page: https://npm.io/package/request-animation-loop

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-07-01

## README

# request-animation-loop

> setInterval is to setTimeout as requestAnimationLoop is to requestAnimationFrame.

[![npm version](https://badge.fury.io/js/request-animation-loop.svg)](http://badge.fury.io/js/request-animation-loop)
[![Build Status](https://travis-ci.org/olahol/request-animation-loop.svg)](https://travis-ci.org/olahol/request-animation-loop)

## Install

```bash
npm install request-animation-loop --save
```

## Example

Rotate an element for 1 second.

```javascript
var deg = 0;
var id = requestAnimationLoop(function (deltaTime) {
  deg += deltaTime * 0.1;
  el.style.transform = "rotate(" + deg + "deg)";
});

setTimeout(function () {
  cancelAnimationLoop(id);
}, 1000);
```

## API

##### requestAnimationLoop(callback(deltaTime, id))

Start an animation loop with function `callback` which recieves a time in
milliseconds since last iteration as `deltaTime` and `id` which is the id
of the loop.

##### cancelAnimationLoop(id)

Stop animation loop with id `id`.

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