summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-02-20 20:10:56 +0100
committerwout <wout@impinc.co.uk>2014-02-20 20:10:56 +0100
commitf3b9e808601e8aa250b9373447527ca67ba75ec4 (patch)
treed76822650cae302be46f8f71908fb868f1754c0c /src
parent2a986d0e0c78b7cdf1c96a737a050f4a764f0ce2 (diff)
downloadsvg.js-f3b9e808601e8aa250b9373447527ca67ba75ec4.tar.gz
svg.js-f3b9e808601e8aa250b9373447527ca67ba75ec4.zip
SVG.Stop accepts multiple arguments1.0.0-rc.6
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gradient.js12
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)