summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-06-01 09:58:22 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-06-01 09:58:22 +0200
commitb27370f0cad27cb83d16ebacb42b4a472d1709b2 (patch)
tree5bb15367ec8994e49fc168b5a2a257f0e5937109 /src
parenta9dc2dd77a68be9d94fe2679ea72fd23595d4538 (diff)
downloadsvg.js-b27370f0cad27cb83d16ebacb42b4a472d1709b2.tar.gz
svg.js-b27370f0cad27cb83d16ebacb42b4a472d1709b2.zip
renamed method names as suggested, added failing test
Diffstat (limited to 'src')
-rw-r--r--src/runner.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/runner.js b/src/runner.js
index 8c58d2e..065967d 100644
--- a/src/runner.js
+++ b/src/runner.js
@@ -192,8 +192,7 @@ SVG.Runner = SVG.invent({
return this._times * (this._wait + this._duration) - this._wait
},
- // FIXME: Proposal - this should be called loops
- position: function (p) {
+ loops: function (p) {
var loopDuration = this._duration + this._wait
if (p == null) {
var loopsDone = Math.floor(this._time / loopDuration)
@@ -207,10 +206,9 @@ SVG.Runner = SVG.invent({
return this.time(time)
},
- // FIXME: Proposal - this should be called position
- local: function (p) {
+ position: function (p) {
if (p == null) {
-
+
/*
This function converts a time to a position in the range [0, 1]
The full explanation can be found in this desmos demonstration
@@ -244,13 +242,13 @@ SVG.Runner = SVG.invent({
}
// Work out the loops done and add the position to the loops done
+ var loopDuration = this._duration + this._wait
var loopsDone = Math.floor(this._time / loopDuration)
var position = loopsDone + p
- return this.position(position)
+ return this.loops(position)
},
- // FIXME - Proposal - this should be called progress
- absolute: function (p) {
+ progress: function (p) {
if (p == null) {
return Math.min(1, this._time / this.duration())
}
@@ -262,7 +260,7 @@ SVG.Runner = SVG.invent({
// Update the time and get the new position
dt = dt == null ? 16 : dt
this._time += dt
- var position = this.local()
+ var position = this.position()
// Figure out if we need to run the stepper in this frame
var runNow = this._lastPosition !== position && this._time >= 0