diff options
author | wout <wout@impinc.co.uk> | 2014-02-20 20:10:56 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-02-20 20:10:56 +0100 |
commit | f3b9e808601e8aa250b9373447527ca67ba75ec4 (patch) | |
tree | d76822650cae302be46f8f71908fb868f1754c0c /src | |
parent | 2a986d0e0c78b7cdf1c96a737a050f4a764f0ce2 (diff) | |
download | svg.js-f3b9e808601e8aa250b9373447527ca67ba75ec4.tar.gz svg.js-f3b9e808601e8aa250b9373447527ca67ba75ec4.zip |
SVG.Stop accepts multiple arguments1.0.0-rc.6
Diffstat (limited to 'src')
-rwxr-xr-x | src/gradient.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gradient.js b/src/gradient.js index 504ec49..895f8ca 100755 --- a/src/gradient.js +++ b/src/gradient.js @@ -31,8 +31,8 @@ SVG.Gradient = SVG.invent({ this } // Add a color stop - , at: function(stop) { - return this.put(new SVG.Stop).update(stop) + , at: function(offset, color, opacity) { + return this.put(new SVG.Stop).update(offset, color, opacity) } // Update gradient , update: function(block) { @@ -83,6 +83,14 @@ SVG.Stop = SVG.invent({ , extend: { // add color stops update: function(o) { + if (typeof o == 'number' || o instanceof SVG.Number) { + o = { + offset: arguments[0] + , color: arguments[1] + , opacity: arguments[2] + } + } + /* set attributes */ if (o.opacity != null) this.attr('stop-opacity', o.opacity) if (o.color != null) this.attr('stop-color', o.color) |