Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
decompose-dommatrix
Advanced tools
Readme
Takes in a DOMMatrix and returns a set of transforms (translateX, rotateZ, etc). This code is mostly lifted from https://github.com/facebook/react-native/blob/master/Libraries/Utilities/MatrixMath.js and can be considered as a standalone decompose function. This is actually useful though since a standalone decompose/unmatrix function for javascript was impossible to find.
Important Note: the transforms are specified in a way that they need to be applied in a specific order to get the same result. Specifically, given a decomposed matrix, to "recompose" the matrix properly you must apply the transforms in the following order: translate, rotate, skew, scale. This is why if you apply some transforms, then get the decomposed matrix you may get different values. i.e. if you do
element.style.transform = 'scale(2) rotate(30deg) translateX(30px)';
const decomposed = decomposeDOMMatrix(new DOMMatrix(getComputedStyle(element).getPropertyValue('transform')));
console.log(JSON.stringify(decomposed));
you will get a different set of numbers. But if you apply those new set of numbers in the specified order (translate, rotate, skew, scale) your element will look the exact same as your original.
import decomposeDOMMatrix from 'decompose-dommatrix';
const decomposed = decomposeDOMMatrix(new DOMMatrix(getComputedStyle(element).getPropertyValue('transform')));
console.log(decomposed.translateX);
decomposeDOMMatrix(matrix: DOMMatrix): TransformValues
Takes in a DOMMatrix and returns a map of transforms to values. All values are either in pixels or degrees, depending on the transform.
translateX, translateY, translateZ: number
The translate values along the various axis. In pixels (px).
rotateX, rotateY, rotateZ: number
The rotation values along the various axis. In degrees (deg).
scaleX, scaleY, scaleZ: number
The scale values along the various axis. Unitless.
skewXY, skewXZ, skewYZ: number
The skew values along the various axis. In degrees (deg).
FAQs
A small library to decompose a DOMMatrix into transform values.
The npm package decompose-dommatrix receives a total of 8 weekly downloads. As such, decompose-dommatrix popularity was classified as not popular.
We found that decompose-dommatrix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.