https://github.com/bcherny/transform-to-matrix
A tiny library to get 2/3D matricies from CSS3 transform functions. Fully covered by unit tests, with support for AMD, CommonJS, Node, and browser globals.
https://github.com/bcherny/transform-to-matrix
Last synced: 6 months ago
JSON representation
A tiny library to get 2/3D matricies from CSS3 transform functions. Fully covered by unit tests, with support for AMD, CommonJS, Node, and browser globals.
- Host: GitHub
- URL: https://github.com/bcherny/transform-to-matrix
- Owner: bcherny
- License: mit
- Created: 2013-09-25T16:05:16.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-10-24T20:34:05.000Z (almost 12 years ago)
- Last Synced: 2024-12-17T03:03:29.133Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 207 KB
- Stars: 11
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# transform-to-matrix
A tiny library to get 2/3D matricies from CSS3 transform functions. Fully covered by unit tests, with support for AMD, CommonJS, Node, and browser globals.
## example
```js
var getMatrix = require('transform-to-matrix'),
matrix = getMatrix.translate3d(10, 50, 100)
// ->
// [
// [1, 0, 0, 10],
// [0, 1, 0, 50],
// [0, 0, 1, 100],
// [0, 0, 0, 1]
// ]
```## supported transforms
- perspective
- rotate
- rotateX
- rotateY
- rotateZ
- rotate3d
- scale
- scaleX
- scaleY
- scaleZ
- scale3d
- skew
- skewX
- skewY
- translate
- translateX
- translateY
- translateZ
- translate3d# see
- https://developer.mozilla.org/en-US/docs/Web/CSS/transform
- http://www.w3.org/TR/css3-transforms/#mathematical-description
- http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/#5.1