# animationframes

> Create animation frames with delay and duration

Latest version **2.0.0** (published 2019-05-31) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-05-31 |
| First published | 2017-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Juha Lindstedt |
| Maintainers | pakastin |

## Links

- npm: https://www.npmjs.com/package/animationframes
- npm.io page: https://npm.io/package/animationframes

## Recent versions

- 2.0.0 (latest) — 2019-05-31
- 1.2.1 — 2017-01-12
- 1.2.0 — 2017-01-11
- 1.1.1 — 2017-01-11
- 1.1.0 — 2017-01-07
- 1.0.0 — 2017-01-07

## README

[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?maxAge=3600&style=flat-square)](https://github.com/Flet/semistandard)
[![npm](https://img.shields.io/npm/v/animationframes.svg?maxAge=60&style=flat-square)](https://www.npmjs.com/package/animationframes)
[![Twitter Follow](https://img.shields.io/twitter/follow/pakastin.svg?style=social&maxAge=3600)](https://twitter.com/pakastin)

# animationframes
Minimalistic way to create JS animations (~1.5 KB). Use [prefix](https://github.com/pakastin/prefix) to auto-prefix CSS properties.

Battle-tested in my [HTML5 Deck of Cards](https://deck-of-cards.js.org), [source](https://github.com/pakastin/deck-of-cards/blob/master/lib/card.js#L65).

## install
```
npm install animationframes
```

## usage

```js
import AnimationFrames from 'animationframes';

const translate = (el, x, y) => el.style.transform = `translate(${x}%, ${y}%)`;
const { from } = AnimationFrames;

const el = document.createElement('h1');

const animation = new AnimationFrames({
  delay: 0,
  duration: 1000,
  oninit () {
    el.style.display = 'none';
  }
  onstart () {
    el.style.display = '';
  }
  onprogress (e) {
    translate(el, from(-100, e), 0);
  },
  onend () {
    el.style.transform = '';
  }
});

el.textContent = 'Hello world!';

document.body.appendChild(el);
```
https://jsfiddle.net/o6vac675/4/

Another example: https://jsfiddle.net/pakastin/fjozqopm/

## easings
Available easings: https://github.com/pakastin/animationframes/blob/master/src/ease.js

## oldskool
```html
<script src="https://pakastin.github.io/animationframes/animationframes.min.js"></script>
<script>
const animation = new AnimationFrames( ... );
...
</script>
```

## License
[MIT](https://github.com/pakastin/animationframes/blob/master/LICENSE)

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