summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-10-13 00:49:35 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-10-13 00:49:35 +0200
commit8db39b099ea85d881f5e4d12b2b2182d41414da4 (patch)
treee1373dc28e8a494413f5b1c0f8418d258b75f29c
parent4f3343ee7667e98a192d46ed709ce0acd96add92 (diff)
downloadsvg.js-8db39b099ea85d881f5e4d12b2b2182d41414da4.tar.gz
svg.js-8db39b099ea85d881f5e4d12b2b2182d41414da4.zip
fix timeline timing with runners
-rw-r--r--src/timeline.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/timeline.js b/src/timeline.js
index c0b0a99..02de178 100644
--- a/src/timeline.js
+++ b/src/timeline.js
@@ -20,10 +20,7 @@ SVG.Timeline = SVG.invent({
inherit: SVG.EventTarget,
// Construct a new timeline on the given element
- create: function (element) {
-
- // Store a reference to the element to call its parent methods
- this._element = element || null
+ create: function () {
this._timeSource = function () {
return time.now()
}
@@ -54,12 +51,6 @@ SVG.Timeline = SVG.invent({
return this._dispatcher
},
- // FIXME: there is no need anymore to save the element on the timeline
- element (element) {
- if(element == null) return this._element
- this._element = element
- },
-
/**
*
*/
@@ -73,6 +64,13 @@ SVG.Timeline = SVG.invent({
})
}
+ if (!this.active()) {
+ this._step()
+ if (when == null) {
+ when = 'now'
+ }
+ }
+
// The start time for the next animation can either be given explicitly,
// derived from the current timeline time or it can be relative to the
// last start time to chain animations direclty
@@ -277,6 +275,10 @@ SVG.Timeline = SVG.invent({
if (!this._nextFrame)
this._nextFrame = SVG.Animator.frame(this._step.bind(this))
return this
+ },
+
+ active () {
+ return !!this._nextFrame
}
},
@@ -284,7 +286,7 @@ SVG.Timeline = SVG.invent({
parent: SVG.Element,
construct: {
timeline: function () {
- this._timeline = (this._timeline || new SVG.Timeline(this))
+ this._timeline = (this._timeline || new SVG.Timeline())
return this._timeline
},
}