aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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)