blob: e7e94a41cc871606181fc3efc56baeb3d418d48b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
SVG.Mask = function Mask() {
this.constructor.call(this, SVG.create('mask'));
/* set unique id */
this.attr('id', (this.id = 'svgjs_element_' + (SVG.did++)));
};
// Inherit from SVG.Element
SVG.Mask.prototype = new SVG.Element();
// Include the container object
SVG.extend(SVG.Mask, SVG.Container);
SVG.extend(SVG.Element, {
// Distribute mask to svg element
maskWith: function(element) {
return this.attr('mask', 'url(#' + (element instanceof SVG.Mask ? element : this.parent.mask().add(element)).id + ')');
}
});
|