summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
},
}