Skip to content

Instantly share code, notes, and snippets.

@rezoner
Created August 15, 2017 12:31
Show Gist options
  • Save rezoner/aa0bc8f87f0b60df13ed92d930b0ae49 to your computer and use it in GitHub Desktop.
Save rezoner/aa0bc8f87f0b60df13ed92d930b0ae49 to your computer and use it in GitHub Desktop.
{
translation: function(tx, ty) {
return [
1, 0, 0,
0, 1, 0,
tx, ty, 1,
];
},
rotation: function(angleInRadians) {
var c = Math.cos(angleInRadians);
var s = Math.sin(angleInRadians);
return [
c, -s, 0,
s, c, 0,
0, 0, 1,
];
},
scaling: function(sx, sy) {
return [
sx, 0, 0,
0, sy, 0,
0, 0, 1,
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment