Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthewmueller/unmatrix
Parse and normalize the individual values of a css transform
https://github.com/matthewmueller/unmatrix
Last synced: about 1 month ago
JSON representation
Parse and normalize the individual values of a css transform
- Host: GitHub
- URL: https://github.com/matthewmueller/unmatrix
- Owner: matthewmueller
- Created: 2013-10-19T18:46:44.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-08-20T11:26:26.000Z (about 9 years ago)
- Last Synced: 2024-04-08T20:10:14.807Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 162 KB
- Stars: 21
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# unmatrix
Parse and normalize the individual values of a css transform.
Uses the same algorithm that Firefox uses to parse the transform string.
Only parses the 2D transform attributes. This library is intentionally low-level
and should probably be used within another library.If you'd like to parse 3D transforms take a look at:
http://www.w3.org/TR/css3-transforms/#matrix-decomposing.## Example
```js
var unmatrix = require('unmatrix');
var t = unmatrix(box);
box.style.webkitTransform = toString(t);
```## Installation
Install with [component(1)](http://component.io):
$ component install matthewmueller/unmatrix
## API
### unmatrix(el)
Parse the individual values of a CSS transform. Returns the following object:
```js
{
"translateX": 400, // px
"translateY": 200, // px
"rotate": 60, // deg
"skew": 20, // deg
"scaleX": 2,
"scaleY": 2
}
```## TODO
- support for transform matrix parsing
- tests would be nice## License
MIT