diff options
author | wout <wout@impinc.co.uk> | 2013-01-30 16:00:03 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-01-30 16:00:03 +0100 |
commit | 4a7588695a1b385f41acd6cbbfaf76b38b2a1439 (patch) | |
tree | 18cf5704748de3fde71281753809034886377dcf /src/sugar.js | |
parent | 610e40c62cfbd704db39c1516320de5cf61e36bd (diff) | |
download | svg.js-4a7588695a1b385f41acd6cbbfaf76b38b2a1439.tar.gz svg.js-4a7588695a1b385f41acd6cbbfaf76b38b2a1439.zip |
Added visible() and opacity() methods0.4
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; } }); |