# mat4-recompose

> recomposes a 4x4 matrix

Latest version **1.0.4** (published 2015-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install mat4-recompose
pnpm add mat4-recompose
yarn add mat4-recompose
bun add mat4-recompose
```

## 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.4 |
| Published | 2015-02-08 |
| First published | 2014-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | mat4, mat4x4, 4x4, matrix, recompose, decompose, animation, lerp, interpolate, animate, matrices, re-compose, de-compose, compose, composition |

## Links

- npm: https://www.npmjs.com/package/mat4-recompose
- Repository: https://github.com/mattdesl/mat4-recompose
- Issues: https://github.com/mattdesl/mat4-recompose/issues
- npm.io page: https://npm.io/package/mat4-recompose

## Dependencies (1)

- [gl-mat4](https://npm.io/package/gl-mat4.md) ^1.0.1

## 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.0.4 (latest) — 2015-02-08
- 1.0.3 — 2014-12-07
- 1.0.2 — 2014-12-07
- 1.0.1 — 2014-12-07
- 1.0.0 — 2014-12-07

## README

# mat4-recompose

[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

Recompose a 4x4 matrix from translation, scale, skew, perspective, and rotation. This is commonly used in matrix animations (i.e. after [decompose](https://github.com/mattdesl/mat4-decompose) and interpolation). Code ported from [W3 CSS Spec](http://www.w3.org/TR/css3-transforms/#decomposing-a-3d-matrix). PRs for more tests/robustness/optimizations welcome. 

You may also be interested in [mat4-interpolate](https://www.npmjs.com/package/mat4-interpolate), [mat4-decompose](https://www.npmjs.com/package/mat4-decompose), and [css-mat4](https://www.npmjs.com/package/css-mat4).

## Usage

[![NPM](https://nodei.co/npm/mat4-recompose.png)](https://nodei.co/npm/mat4-recompose/)

#### `recompose(matrix, translation, scale, skew, perspective, quaternion)`

Recomposes a matrix with the given vectors, storing the result into `matrix` (a 16 float array). 

- `translation` [x, y, z]
- `scale` [x, y, z]
- `skew` [xy, xz, yz] skew factors
- `perspective` [x, y, z, w]
- `quaternion` [x, y, z, w]

Returns the `matrix` being recomposed.

Builds a translation matrix, then applies the quaternion rotation and perspective. The matrix is then multiplied by YZ shear, then XZ shear, then XY shear (if they are non-zero). Finally multiplied by scale to get the resulting recomposed matrix.

## License

MIT, see [LICENSE.md](http://github.com/mattdesl/mat4-recompose/blob/master/LICENSE.md) for details.

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