diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-12-23 19:02:05 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2015-12-23 19:02:05 +0100 |
commit | 2566a08d4425b6114b37b8a7383a5542afb5ce24 (patch) | |
tree | c31d6578c7e6a7ee5eb0ed59ae359f26c4b22ec6 /dist/svg.js | |
parent | 14d36f8df749eb092d84cea226ca9a25dcfde342 (diff) | |
download | svg.js-2566a08d4425b6114b37b8a7383a5542afb5ce24.tar.gz svg.js-2566a08d4425b6114b37b8a7383a5542afb5ce24.zip |
relative movements, delayed (queued) start of animation
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/dist/svg.js b/dist/svg.js index fa1bbcd..338405d 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7 +6,7 @@ * @copyright Wout Fierens <wout@impinc.co.uk> * @license MIT * -* BUILT: Mon Dec 21 2015 18:36:03 GMT+0100 (Mitteleuropäische Zeit) +* BUILT: Wed Dec 23 2015 19:00:21 GMT+0100 (Mitteleuropäische Zeit) */; (function(root, factory) { if (typeof define === 'function' && define.amd) { @@ -1423,6 +1423,8 @@ SVG.FX = SVG.invent({ for(i in this.animations){ // TODO: this is not a clean clone of the array. We may have some unchecked references this.animations[i].value = (i == 'plot' ? this.target.array().value : this.target[i]()) + if(this.animations[i].relative) + this.animations[i].destination.value = this.animations[i].destination.value + this.animations[i].value } for(i in this.attrs){ @@ -1432,7 +1434,7 @@ SVG.FX = SVG.invent({ this.attrs[i].g = color.g this.attrs[i].b = color.b }else{ - this.attrs[i].value = this.target.attr(i) + this.attrs[i].value = this.target.attr(i) + this.attrs[i].value } } @@ -1593,7 +1595,8 @@ SVG.FX = SVG.invent({ // adds one property to the animations , push: function(method, args, type){ this[type || 'animations'][method] = args - return this.start() + setTimeout(function(){this.start()}.bind(this), 0) + return this } // removes the specified animation and returns it @@ -1893,20 +1896,24 @@ SVG.extend(SVG.FX, { return this } // Animatable x-axis -, x: function(x) { - return this.push('x', new SVG.Number(this.search('x')).morph(x)) +, x: function(x, relative) { + var num = new SVG.Number(/*this.search('x')*/0).morph(x) + num.relative = relative + return this.push('x', num) } // Animatable y-axis -, y: function(y) { - return this.push('y', new SVG.Number(this.search('y')).morph(y)) +, y: function(y, relative) { + var num = new SVG.Number(/*this.search('y')*/).morph(y) + num.relative = relative + return this.push('y', num) } // Animatable center x-axis , cx: function(x) { - return this.push('cx', new SVG.Number(this.search('cx')).morph(x)) + return this.push('cx', new SVG.Number(/*this.search('cx')*/).morph(x)) } // Animatable center y-axis , cy: function(y) { - return this.push('cy', new SVG.Number(this.search('cy')).morph(y)) + return this.push('cy', new SVG.Number(/*this.search('cy')*/).morph(y)) } // Add animatable move , move: function(x, y) { @@ -1932,8 +1939,8 @@ SVG.extend(SVG.FX, { box = this.target.bbox() } - this.push('width' , new SVG.Number(w || box.width).morph(width)) - .push('height', new SVG.Number(h || box.height).morph(height)) + this.push('width' , new SVG.Number(/*w || box.width*/).morph(width)) + .push('height', new SVG.Number(/*h || box.height*/).morph(height)) } @@ -1946,7 +1953,7 @@ SVG.extend(SVG.FX, { // Add leading method , leading: function(value) { return this.target.leading ? - this.push('leading', new SVG.Number(this.search('leading')).morph(value)) : + this.push('leading', new SVG.Number(/*this.search('leading')*/).morph(value)) : this } // Add animatable viewbox @@ -4333,11 +4340,11 @@ SVG.extend(SVG.Element, SVG.FX, { } // Relative move over x axis , dx: function(x) { - return this.x((this.search ? this.search('x') : this.x()) + x) + return this.x((this instanceof SVG.FX ? 0 : this.x()) + x, true) } // Relative move over y axis , dy: function(y) { - return this.y((this.search ? this.search('x') : this.y()) + y) + return this.y((this instanceof SVG.FX ? 0 : this.y()) + y, true) } // Relative move over x and y axes , dmove: function(x, y) { |