# @phenomenon/lightning

> The extendable TypeScript animation library.

Latest version **0.4.0** (published 2020-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @phenomenon/lightning
pnpm add @phenomenon/lightning
yarn add @phenomenon/lightning
bun add @phenomenon/lightning
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2020-02-12 |
| First published | 2020-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 48.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | kacperkozak |

## Links

- npm: https://www.npmjs.com/package/@phenomenon/lightning
- npm.io page: https://npm.io/package/@phenomenon/lightning

## Recent versions

- 0.4.0 (latest) — 2020-02-12
- 0.3.1 — 2020-01-29
- 0.3.0 — 2020-01-29
- 0.2.0 — 2020-01-27
- 0.1.0 — 2020-01-27

## README

# Lighting

The extendable TypeScript animation library.

```
yarn add @phenomenon/lightning

npm install @phenomenon/lightning
```

## Examples

```js
import { lightning, animate, fromTo, delay, val } from '@phenomenon/lightning'

const frames = animate('#my-element', [
    fromTo({ opacity: val(0, 1) }, 400),
    delay(1000),
    fromTo({ opacity: val(1, 0) }, 400),
])

lightning(frames).play()
```

Using `parallel`, `cascade` or `sequence`.

```js
import {
    lightning,
    animate,
    parallel,
    fromTo,
    delay,
    set,
    val,
    color,
    transform,
} from '@phenomenon/lightning'

const bodyFrames = animate('body', [
    fromTo({ backgroundColor: color('#FF0000', '#00FF00') }, 1500),
])

const elementFrames = animate('#my-element', [
    delay(500),
    set({ display: ['none', 'block'] }),
    fromTo(
        {
            opacity: val(0, 1),
            transform: transform({
                y: val(-200, 0, 'px'),
                scale: val(0.9, 1),
                rotate: val(10, 0, 'deg'),
            }),
        },
        500,
    ),
])

const frames = parallel([bodyFrames, elementFrames])

const animation = lightning(frames, {
    onComplete() {
        console.log('onComplete')
        animation.play() // loop
    },
})

animation.seek(500)
animation.play()
```

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