Blame view

node_modules/zrender/src/graphic/RadialGradient.ts 1020 Bytes
bd028579   易尊强   2/28
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
43
  import Gradient, {GradientColorStop, GradientObject} from './Gradient';
  
  export interface RadialGradientObject extends GradientObject {
      type: 'radial'
  
      x: number
      y: number
      r: number
  }
  /**
   * x, y, r are all percent from 0 to 1 when globalCoord is false
   */
  class RadialGradient extends Gradient {
  
      type: 'radial'
  
      x: number
      y: number
      r: number
  
      constructor(
          x: number, y: number, r: number,
          colorStops?: GradientColorStop[], globalCoord?: boolean
      ) {
          super(colorStops);
          // 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;
      }
  }
  
  export default RadialGradient;