aboutsummaryrefslogtreecommitdiffstats
path: root/src/fx.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-09 09:47:23 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-09 09:47:23 +0100
commit4f4f098c8026d1a42356555088eaa0b67ceabfa8 (patch)
tree47e40516ff60a699b42badd6c03c5903156ffe5e /src/fx.js
parent8a0a4d797f8954a3b1964c6e407d9291d4afc7ab (diff)
downloadsvg.js-4f4f098c8026d1a42356555088eaa0b67ceabfa8.tar.gz
svg.js-4f4f098c8026d1a42356555088eaa0b67ceabfa8.zip
start the animation when after(All)/during(All) is called (#583)
Diffstat (limited to 'src/fx.js')
-rw-r--r--src/fx.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/fx.js b/src/fx.js
index 157c4f9..98ded65 100644
--- a/src/fx.js
+++ b/src/fx.js
@@ -422,7 +422,8 @@ SVG.FX = SVG.invent({
}
this.target().on('finished.fx', wrapper)
- return this
+
+ return this._callStart()
}
// adds a callback which is called whenever one animation step is performed
@@ -437,9 +438,11 @@ SVG.FX = SVG.invent({
// see above
this.target().off('during.fx', wrapper).on('during.fx', wrapper)
- return this.after(function(){
+ this.after(function(){
this.off('during.fx', wrapper)
})
+
+ return this._callStart()
}
// calls after ALL animations in the queue are finished
@@ -451,7 +454,8 @@ SVG.FX = SVG.invent({
// see above
this.target().off('allfinished.fx', wrapper).on('allfinished.fx', wrapper)
- return this
+
+ return this._callStart()
}
// calls on every animation step for all animations
@@ -462,9 +466,11 @@ SVG.FX = SVG.invent({
this.target().off('during.fx', wrapper).on('during.fx', wrapper)
- return this.afterAll(function(){
+ this.afterAll(function(){
this.off('during.fx', wrapper)
})
+
+ return this._callStart()
}
, last: function(){
@@ -474,8 +480,7 @@ SVG.FX = SVG.invent({
// adds one property to the animations
, add: function(method, args, type){
this.last()[type || 'animations'][method] = args
- setTimeout(function(){this.start()}.bind(this), 0)
- return this
+ return this._callStart()
}
/** perform one step of the animation
@@ -663,6 +668,11 @@ SVG.FX = SVG.invent({
return this
}
+ , _callStart: function() {
+ setTimeout(function(){this.start()}.bind(this), 0)
+ return this
+ }
+
}
, parent: SVG.Element