Catalog npm
Back to packageRELEASE DETAILS

1.0.0

npm

2d-css-matrix-parse

Module that parse a 2D css transform matrix into a 3x3 array. Also the module allow you get the matrix array from a specified element

2d3x3animationscss-parsematrixmatrix2dparsescaletransformtransformationtranslate
Published7 Dec 2015
Direct dependencies2
Transitive dependenciesNot calculated

README

Current package documentation

2d-css-matrix-parse

stable

Converts css transform matrix to an 2D array of 6 values(3x3 matrix).

Function parse

The parse function takes a matrix string representation like matrix(1.1, 0, 0, 1.1, 0, 0) and parse it to an array of floats.

var matrixTransform = require('./index.js');

var matrix = "matrix(1.1, 0, 0, 1.1, 0, 0)";

matrixTransform.parse(matrix);
// -> [1.1, 0, 0, 1.1, 0, 0]

Function fromElement

The fromElement function tries to help you to get the transform string matrix representation and let you pass instead of the string the HTML element itself.

var matrixTransform = require('./index.js');

var element = document.createElement('div');
element.style.transform = "scale(1.5)";
document.body.appendChild(element);

matrixTransform.fromElement(element);
// -> [1.5,0,0,1.5,0,0]

Important Note:

Doesn't matter if the transform is not formatted as a matrix, in the above example we are setting to element the value scale instead of the current matrix.

Usage

NPM

matrixTransform.parse(string)

It takes a string matrix representation and gives you an array.

matrixTransform.fromElement(HtmlElement)

It takes an Html Element and gives you an array with the element transformation.

License

MIT, see LICENSE.md for details.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 2

Native requirements
2 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
get-style-property
Environment
{
  "local_name": "get-style-property",
  "alias": false,
  "peer_metadata": null
}
^0.1.1runtime
tape
Environment
{
  "local_name": "tape",
  "alias": false,
  "peer_metadata": null
}
^4.2.2development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "b371214d77dbfe79e3b8da4e0ce57f6e68bb76e7",
  "tarball": "https://registry.npmjs.org/2d-css-matrix-parse/-/2d-css-matrix-parse-1.0.0.tgz",
  "integrity": "sha512-UfjgfnraVU0LhNoYaGuQwTy9YQ1lH6M0ntZDvF7YH2mpiQwhXzuYN44SAQvqqXkdbPa7a7a9XRoBBsgBESq0pw==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQDl5X9WOQzGBTAofcfKfOqZlTCTF2Xrv1kOMXgR/j8s7gIhAOuPPVSigN7WUH0X/1Vy2T4uIvu+MTlsUhm2NJR87P4u"
    }
  ]
}

Repository

PENDING
iranreyes/2d-css-matrix-parse

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:178f6f86f1f98978e40df46a6be80b9bbc9e18eac7264d09ef84e2144d98691d

Other collected versions

View all collected versions →