blob: b5baa14e96d08c5e23787ad3fd218e3aefc7185e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
SVG.Mask = function Mask() {
this.constructor.call(this, SVG.create('mask'));
/* set unique id */
this.id = 'svgjs_' + (SVG.did++);
this.attr('id', this.id);
};
// 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 + ')');
}
});
|