Skip to content

Instantly share code, notes, and snippets.

@danielronnkvist
Created January 4, 2016 15:04
Show Gist options
  • Save danielronnkvist/f5d7f33dece04c379718 to your computer and use it in GitHub Desktop.
Save danielronnkvist/f5d7f33dece04c379718 to your computer and use it in GitHub Desktop.
Get a css 2D matrix for transformations.
function getTransformationMatrix(rotation, scale, translateX, translateY){
var matrix = [scale * Math.cos(rotation), scale * Math.sin(rotation),
-scale * Math.sin(rotation), scale * Math.cos(rotation),
translateX, translateY]
return matrix.join(", ")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment