blob: 1631b4a8abaa6d20dc652746fe44f50fd6363d47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import Base from './Base.js'
import SVGNumber from './SVGNumber.js'
import {nodeOrNew} from './tools.js'
export default class Stop extends Base {
constructor (node) {
super(nodeOrNew('stop', node), Stop)
}
// add color stops
update (o) {
if (typeof o === 'number' || o instanceof SVGNumber) {
o = {
offset: arguments[0],
color: arguments[1],
opacity: arguments[2]
}
}
// set attributes
if (o.opacity != null) this.attr('stop-opacity', o.opacity)
if (o.color != null) this.attr('stop-color', o.color)
if (o.offset != null) this.attr('offset', new SVGNumber(o.offset))
return this
}
}
|