diff options
Diffstat (limited to 'src/sugar.js')
-rw-r--r-- | src/sugar.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sugar.js b/src/sugar.js index a5725e1..bd8930e 100644 --- a/src/sugar.js +++ b/src/sugar.js @@ -51,6 +51,15 @@ var _colorPrefix = function(type, attr) { scaleX: x, scaleY: y == null ? x : y }); + }, + // Opacity + opacity: function(value) { + if (['rect', 'ellipse', 'polygon', 'path', 'polyline', 'line', 'text'].indexOf(this.type) > -1) + this.attr({ 'fill-opacity': value, 'stroke-opacity': value }); + else + this.attr('opacity', value); + + return this; } }); |