blob: 12fc13b7cfeca0157085a77cbc42ae7b2fdf1809 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
SVG.Mask = function() {
this.constructor.call(this, SVG.create('mask'))
}
// Inherit from SVG.Container
SVG.Mask.prototype = new SVG.Container
SVG.extend(SVG.Element, {
// Distribute mask to svg element
maskWith: function(element) {
/* use given mask or create a new one */
this.mask = element instanceof SVG.Mask ? element : this.parent.mask().add(element)
return this.attr('mask', 'url(#' + this.mask.attr('id') + ')')
}
})
|