diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2016-02-15 23:11:50 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2016-02-15 23:11:50 +0100 |
commit | 5bfb9127cb5126eb2f53fd50fba53711bc899a54 (patch) | |
tree | 3d196482d1748c2207d0cd17d15fc71a38ac1ea5 | |
parent | 64784ffc12d1c4cffd23cd94a5430e3fc1544861 (diff) | |
download | svg.js-5bfb9127cb5126eb2f53fd50fba53711bc899a54.tar.gz svg.js-5bfb9127cb5126eb2f53fd50fba53711bc899a54.zip |
make the animate method compatible to v2 again
-rw-r--r-- | src/fxnew.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/fxnew.js b/src/fxnew.js index 6e2ad35..324ab53 100644 --- a/src/fxnew.js +++ b/src/fxnew.js @@ -53,21 +53,25 @@ SVG.FX = SVG.invent({ , extend: { // sets up the animation - animate: function(o){ + animate: function(o, easing, delay){ // the end time of the previous is our start var start = this._prev ? this._prev._end : +new Date - o = o || {} + if(typeof o == 'object'){ + easing = o.ease + delay = o.delay + o = o.duration + } - if(typeof o == 'number') o = {duration:o} + //if(typeof o == 'number') o = {duration:o} - this._duration = o.duration || 1000 - this._delay = o.delay || 0 + this._duration = o || 1000 + this._delay = delay || 0 this._start = start + this._delay this._end = this._start + this._duration - this.easing = SVG.easing[o.easing || '-'] || o.easing // when easing is a function, its not in SVG.easing + this.easing = SVG.easing[easing || '-'] || easing // when easing is a function, its not in SVG.easing this.init = false |