summaryrefslogtreecommitdiffstats
path: root/src/sugar.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-01-30 16:00:03 +0100
committerwout <wout@impinc.co.uk>2013-01-30 16:00:03 +0100
commit4a7588695a1b385f41acd6cbbfaf76b38b2a1439 (patch)
tree18cf5704748de3fde71281753809034886377dcf /src/sugar.js
parent610e40c62cfbd704db39c1516320de5cf61e36bd (diff)
downloadsvg.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.js9
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;
}
});