Skip to content

Commit

Permalink
use spine.Rotation cos/sin members
Browse files Browse the repository at this point in the history
  • Loading branch information
flyover committed Apr 25, 2016
1 parent 0228095 commit b58db1d
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions spine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1250,11 +1250,10 @@ spine.Space.invert = function(space, out) {
}
var x = 0 - space.position.x;
var y = 0 - space.position.y;
var rad = -space.rotation.rad;
var c = Math.cos(rad);
var s = Math.sin(rad);
var tx = c * x - s * y;
var ty = s * x + c * y;
var c = space.rotation.cos;
var s = space.rotation.sin;
var tx = s * y + c * x;
var ty = c * y - s * x;
out.position.x = tx;
out.position.y = ty;
spine.Matrix.untransform(space.scale, out.position, out.position);
Expand All @@ -1276,9 +1275,8 @@ spine.Space.combine = function(a, b, out) {
out = out || new spine.Space();
var x = a.scale.a * b.position.x + a.scale.b * b.position.y;
var y = a.scale.c * b.position.x + a.scale.d * b.position.y;
var rad = a.rotation.rad;
var c = Math.cos(rad);
var s = Math.sin(rad);
var c = a.rotation.cos;
var s = a.rotation.sin;
var tx = c * x - s * y;
var ty = s * x + c * y;
out.position.x = a.position.x + tx;
Expand Down Expand Up @@ -1313,11 +1311,10 @@ spine.Space.extract = function(ab, a, out) {
}
var x = ab.position.x - a.position.x;
var y = ab.position.y - a.position.y;
var rad = -a.rotation.rad;
var c = Math.cos(rad);
var s = Math.sin(rad);
var tx = c * x - s * y;
var ty = s * x + c * y;
var c = a.rotation.cos;
var s = a.rotation.sin;
var tx = s * y + c * x;
var ty = c * y - s * x;
out.position.x = tx;
out.position.y = ty;
spine.Matrix.untransform(a.scale, out.position, out.position);
Expand All @@ -1334,9 +1331,8 @@ spine.Space.transform = function(space, v, out) {
out = out || new spine.Vector();
spine.Matrix.transform(space.scale, v, out);
var x = out.x, y = out.y;
var rad = space.rotation.rad;
var c = Math.cos(rad);
var s = Math.sin(rad);
var c = space.rotation.cos;
var s = space.rotation.sin;
var tx = c * x - s * y;
var ty = s * x + c * y;
out.x = space.position.x + tx;
Expand All @@ -1354,11 +1350,10 @@ spine.Space.untransform = function(space, v, out) {
out = out || new spine.Vector();
var x = v.x - space.position.x;
var y = v.y - space.position.y;
var rad = -space.rotation.rad;
var c = Math.cos(rad);
var s = Math.sin(rad);
var tx = c * x - s * y;
var ty = s * x + c * y;
var c = space.rotation.cos;
var s = space.rotation.sin;
var tx = s * y + c * x;
var ty = c * y - s * x;
out.x = tx;
out.y = ty;
spine.Matrix.untransform(space.scale, out, out);
Expand Down

0 comments on commit b58db1d

Please sign in to comment.