summaryrefslogtreecommitdiffstats
path: root/src/runner.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/runner.js')
-rw-r--r--src/runner.js7
1 files changed, 7 insertions, 0 deletions
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) {