diff options
author | wout <wout@impinc.co.uk> | 2014-07-30 11:04:56 +0200 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-07-30 11:04:56 +0200 |
commit | 725828a6fc3ad423b4bd61710fe541d9b5feb3a1 (patch) | |
tree | 43bcdc2d3e6658e6f6f5b70de3dd71f5bcec35fe /src/set.js | |
parent | 411a621d7ac1b84c684d59b99bd4979f28805a64 (diff) | |
download | svg.js-725828a6fc3ad423b4bd61710fe541d9b5feb3a1.tar.gz svg.js-725828a6fc3ad423b4bd61710fe541d9b5feb3a1.zip |
Added reverse functionality for animation loops
Diffstat (limited to 'src/set.js')
-rwxr-xr-x | src/set.js | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -20,7 +20,7 @@ SVG.Set = SVG.invent({ , remove: function(element) { var i = this.index(element) - /* remove given child */ + // remove given child if (i > -1) this.members.splice(i, 1) @@ -35,7 +35,7 @@ SVG.Set = SVG.invent({ } // Restore to defaults , clear: function() { - /* initialize store */ + // initialize store this.members = [] return this @@ -68,11 +68,11 @@ SVG.Set = SVG.invent({ , bbox: function(){ var box = new SVG.BBox() - /* return an empty box of there are no members */ + // return an empty box of there are no members if (this.members.length == 0) return box - /* get the first rbox and update the target bbox */ + // get the first rbox and update the target bbox var rbox = this.members[0].rbox() box.x = rbox.x box.y = rbox.y @@ -80,7 +80,7 @@ SVG.Set = SVG.invent({ box.height = rbox.height this.each(function() { - /* user rbox for correct position and visual representation */ + // user rbox for correct position and visual representation box = box.merge(this.rbox()) }) @@ -97,10 +97,10 @@ SVG.Set = SVG.invent({ } }) -SVG.SetFX = SVG.invent({ +SVG.FX.Set = SVG.invent({ // Initialize node create: function(set) { - /* store reference to set */ + // store reference to set this.set = set } @@ -111,33 +111,33 @@ SVG.Set.inherit = function() { var m , methods = [] - /* gather shape methods */ + // gather shape methods for(var m in SVG.Shape.prototype) if (typeof SVG.Shape.prototype[m] == 'function' && typeof SVG.Set.prototype[m] != 'function') methods.push(m) - /* apply shape aliasses */ + // apply shape aliasses methods.forEach(function(method) { SVG.Set.prototype[method] = function() { for (var i = 0, il = this.members.length; i < il; i++) if (this.members[i] && typeof this.members[i][method] == 'function') this.members[i][method].apply(this.members[i], arguments) - return method == 'animate' ? (this.fx || (this.fx = new SVG.SetFX(this))) : this + return method == 'animate' ? (this.fx || (this.fx = new SVG.FX.Set(this))) : this } }) - /* clear methods for the next round */ + // clear methods for the next round methods = [] - /* gather fx methods */ + // gather fx methods for(var m in SVG.FX.prototype) - if (typeof SVG.FX.prototype[m] == 'function' && typeof SVG.SetFX.prototype[m] != 'function') + if (typeof SVG.FX.prototype[m] == 'function' && typeof SVG.FX.Set.prototype[m] != 'function') methods.push(m) - /* apply fx aliasses */ + // apply fx aliasses methods.forEach(function(method) { - SVG.SetFX.prototype[method] = function() { + SVG.FX.Set.prototype[method] = function() { for (var i = 0, il = this.set.members.length; i < il; i++) this.set.members[i].fx[method].apply(this.set.members[i].fx, arguments) |