/ Published in: ActionScript 3
Used this snippet in various projects.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
rotation = Math.atan( -mat.c / mat.a); scaleX = Math.sqrt((mat.a * mat.a) + (mat.c * mat.c)); scaleY = Math.sqrt((mat.b * mat.b) + (mat.d * mat.d)); sign = Math.atan(-c / a); rad = Math.acos(a / scaleX); deg = rad * degree; if (deg > 90 && sign > 0) { rotation = (360 - deg) * radian; } else if (deg < 90 && sign < 0) { rotation = (360 - deg) * radian; } else { rotation = rad; } rotationInDegree = rotation * degree;
URL: http://www.infogroupindia.com/blog/posts/589/action-script-3-2d-matrix-scale-and-rotation-extraction