diff options
author | Saivan <savian@me.com> | 2018-06-29 09:18:54 +1000 |
---|---|---|
committer | Saivan <savian@me.com> | 2018-06-29 09:18:54 +1000 |
commit | 9e7d902339755b37ba228f837700c3886a337aa2 (patch) | |
tree | dc0e1690f5b2a13c397d0c77e43560172985eae9 /src | |
parent | 6ff9882c7c85fcd399b9c623f60d5d466cdbb99b (diff) | |
download | svg.js-9e7d902339755b37ba228f837700c3886a337aa2.tar.gz svg.js-9e7d902339755b37ba228f837700c3886a337aa2.zip |
Added a potential fix for the problem
Diffstat (limited to 'src')
-rw-r--r-- | src/matrix.js | 1 | ||||
-rw-r--r-- | src/runner.js | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/matrix.js b/src/matrix.js index 05e9c7d..4396816 100644 --- a/src/matrix.js +++ b/src/matrix.js @@ -129,6 +129,7 @@ SVG.Matrix = SVG.invent({ var lam = (a * c + b * d) / determinant var sy = ((c * sx) / (lam * a - b)) || ((d * sx) / (lam * b + a)) + // Use the translations let tx = e - cx + cx * ct * sx + cy * (lam * ct * sx - st * sy) let ty = f - cy + cx * st * sx + cy * (lam * st * sx + ct * sy) diff --git a/src/runner.js b/src/runner.js index 963f31b..4c9dda2 100644 --- a/src/runner.js +++ b/src/runner.js @@ -700,6 +700,13 @@ SVG.extend(SVG.Runner, { } // FIXME: correct the rotation so that it takes the shortest path + // GIVE ME (rCurrent) (rTarget) - to store the current/target angle + const possibilities = [rTarget - 360, rTarget, rTarget + 360] + const distances = possibilities.map( a => Math.abs(a - rCurrent) ) + const shortest = Math.min(...distances) + const index = distances.indexOf(shortest) + const target = possibilities[index] + morpher.from(startMatrix) }, function (pos) { |