# pasition

> Path Transition with little JS code, render to anywhere.

Latest version **1.0.3** (published 2019-09-13) · MIT license · 0 weekly downloads

## Install

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

## 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.0.3 |
| Published | 2019-09-13 |
| First published | 2017-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 106.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1207 |
| Author | dntzhang |
| Maintainers | dntzhang |
| Keywords | pasition, path, svg, canvas |

## Links

- npm: https://www.npmjs.com/package/pasition
- Repository: https://github.com/AlloyTeam/pasition
- Homepage: http://alloyteam.github.io/pasition
- Issues: https://github.com/AlloyTeam/pasition/issues/new
- npm.io page: https://npm.io/package/pasition

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2019-09-13
- 1.0.2 — 2019-08-27
- 1.0.1 — 2017-06-21
- 1.0.0 — 2017-06-20
- 0.5.1 — 2017-06-19
- 0.5.0 — 2017-06-19
- 0.4.2 — 2017-06-19
- 0.4.1 — 2017-06-19
- 0.4.0 — 2017-06-18
- 0.3.0 — 2017-06-16
- 0.2.1 — 2017-06-15
- 0.2.0 — 2017-06-15
- 0.1.2 — 2017-06-14
- 0.1.1 — 2017-06-14
- 0.1.0 — 2017-06-14
- … 1 more at https://npm.io/package/pasition/versions

## README

<p align="center">
  <a href ="##"><img alt="pasition" src="http://images2015.cnblogs.com/blog/105416/201706/105416-20170620094820476-131210795.gif"></a><a href ="##"><img alt="pasition" src="http://images2015.cnblogs.com/blog/105416/201706/105416-20170620094817554-48316107.gif"></a>
</p>
<h3 align="center">
Pasition - Path Transition with little JS code, render to anywhere.
</h3>

---

## [中文 README](https://github.com/dntzhang/pasition/blob/master/docs/release.md)

## DEMO

* [https://dntzhang.github.io/pasition/](https://dntzhang.github.io/pasition/)

## Install

```
npm install pasition
```

or get js by the cdn address:

[https://unpkg.com/pasition](https://unpkg.com/pasition)

## Usage

```js
pasition.animate({
    from : fromPath,
    to : toPath,
    time : time,
    easing : function(){ },
    begin : function(shapes){ },
    progress : function(shapes, percent){ },
    end : function(shapes){ }
})
```

you can get the path from attr d of svg path element.

Supported All the svg path commands:

```
M/m = moveto
L/l = lineto
H/h = horizontal lineto
V/v = vertical lineto
C/c = curveto
S/s = smooth curveto
A/a = elliptical Arc
Z/z = closepath
Q/q = quadratic Belzier curve
T/t = smooth quadratic Belzier curveto
```

Example:

```js
pasition.animate({
    from: 'M 40 40 Q 60 80 80 40T 120 40 T 160 40 z',
    to: 'M32,0C14.4,0,0,14.4,0,32s14.3,32,32,32 s32-14.3,32-32S49.7,0,32,0z',
    time: 1000,
    easing : function(){ },
    begin:function(shapes){ },
    progress : function(shapes, percent){
        //render you shape to svg or canvas or webgl
    },
    end : function(shapes){ }
});
```

you can get the progressing shapes by `pasition.lerp`:

```js
var shapes  = pasition.lerp(pathA, pathB, 0.5)
//render shapes in canvas ,svg or anywhere you want
...
```

# License
This content is released under the [MIT](http://opensource.org/licenses/MIT) License.

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