I want to split css transform values into an array, while keeping rotate values grouped together.
For instance:
'translate3d(20px, 5px, 10px) rotateX(20deg) rotateY(10deg) rotateZ(0deg) skew3d(20deg, 10deg) rotateX(-20deg) rotateY(100deg) rotateZ(-30deg)'
should become
[
'translate3d(20px, 5px, 10px)',
'rotateX(20deg) rotateY(10deg) rotateZ(0deg)',
'skew3d(20deg, 10deg)',
'rotateX(-20deg) rotateY(100deg) rotateZ(-30deg)'
]
We can assume that the rotate values will always follow this sequence
rotateX(20deg) rotateY(10deg) rotateZ(0deg)
.
Is it possible to achieve this using regex in javascript? Any help is appreciated!