RadialGradient.js
941 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
import * as zrUtil from '../core/util';
import Gradient from './Gradient';
/**
* x, y, r are all percent from 0 to 1
* @param {number} [x=0.5]
* @param {number} [y=0.5]
* @param {number} [r=0.5]
* @param {Array.<Object>} [colorStops]
* @param {boolean} [globalCoord=false]
*/
var RadialGradient = function (x, y, r, colorStops, globalCoord) {
// Should do nothing more in this constructor. Because gradient can be
// declard by `color: {type: 'radial', colorStops: ...}`, where
// this constructor will not be called.
this.x = x == null ? 0.5 : x;
this.y = y == null ? 0.5 : y;
this.r = r == null ? 0.5 : r;
// Can be cloned
this.type = 'radial';
// If use global coord
this.global = globalCoord || false;
Gradient.call(this, colorStops);
};
RadialGradient.prototype = {
constructor: RadialGradient
};
zrUtil.inherits(RadialGradient, Gradient);
export default RadialGradient;