Blame view

node_modules/zrender/src/graphic/LinearGradient.js 1003 Bytes
aaac7fed   liuqimichale   add
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
40
41
42
  import * as zrUtil from '../core/util';
  import Gradient from './Gradient';
  
  /**
   * x, y, x2, y2 are all percent from 0 to 1
   * @param {number} [x=0]
   * @param {number} [y=0]
   * @param {number} [x2=1]
   * @param {number} [y2=0]
   * @param {Array.<Object>} colorStops
   * @param {boolean} [globalCoord=false]
   */
  var LinearGradient = function (x, y, x2, y2, colorStops, globalCoord) {
      // Should do nothing more in this constructor. Because gradient can be
      // declard by `color: {type: 'linear', colorStops: ...}`, where
      // this constructor will not be called.
  
      this.x = x == null ? 0 : x;
  
      this.y = y == null ? 0 : y;
  
      this.x2 = x2 == null ? 1 : x2;
  
      this.y2 = y2 == null ? 0 : y2;
  
      // Can be cloned
      this.type = 'linear';
  
      // If use global coord
      this.global = globalCoord || false;
  
      Gradient.call(this, colorStops);
  };
  
  LinearGradient.prototype = {
  
      constructor: LinearGradient
  };
  
  zrUtil.inherits(LinearGradient, Gradient);
  
  export default LinearGradient;