diff options
Diffstat (limited to 'src/elements/Stop.js')
-rw-r--r-- | src/elements/Stop.js | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/elements/Stop.js b/src/elements/Stop.js index 8838923..9a5acaa 100644 --- a/src/elements/Stop.js +++ b/src/elements/Stop.js @@ -3,35 +3,27 @@ import Element from './Element.js' import SVGNumber from '../types/SVGNumber.js' export default class Stop extends Element { - - constructor ( node ) { - - super( nodeOrNew( 'stop', node ), node ) - + constructor (node) { + super(nodeOrNew('stop', node), node) } // add color stops - update ( o ) { - - if ( typeof o === 'number' || o instanceof SVGNumber ) { - + 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 ) ) + 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 - } - } -register( Stop ) +register(Stop) |