diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-04-09 21:19:14 +1000 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2020-04-09 21:19:14 +1000 |
commit | 02cbd2998c3c36b88701ce83089df8947be1de9f (patch) | |
tree | 668e6cf5db5bfbdb37a774363757970c4cb655b0 /src/elements/Stop.js | |
parent | 25461a4733d7dcfc6f8127e8419f5eddbbb4b4aa (diff) | |
download | svg.js-02cbd2998c3c36b88701ce83089df8947be1de9f.tar.gz svg.js-02cbd2998c3c36b88701ce83089df8947be1de9f.zip |
added test for Gradient
Diffstat (limited to 'src/elements/Stop.js')
-rw-r--r-- | src/elements/Stop.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/elements/Stop.js b/src/elements/Stop.js index d258b86..d29090c 100644 --- a/src/elements/Stop.js +++ b/src/elements/Stop.js @@ -1,6 +1,7 @@ import { nodeOrNew, register } from '../utils/adopter.js' import Element from './Element.js' import SVGNumber from '../types/SVGNumber.js' +import { registerMethods } from '../utils/methods.js' export default class Stop extends Element { constructor (node, attrs = node) { @@ -26,4 +27,13 @@ export default class Stop extends Element { } } +registerMethods({ + Gradient: { + // Add a color stop + stop: function (offset, color, opacity) { + return this.put(new Stop()).update(offset, color, opacity) + } + } +}) + register(Stop, 'Stop') |