RadialGradient.js 935 B

1234567891011121314151617181920212223242526272829303132
  1. var zrUtil = require("../core/util");
  2. var Gradient = require("./Gradient");
  3. /**
  4. * x, y, r are all percent from 0 to 1
  5. * @param {number} [x=0.5]
  6. * @param {number} [y=0.5]
  7. * @param {number} [r=0.5]
  8. * @param {Array.<Object>} [colorStops]
  9. * @param {boolean} [globalCoord=false]
  10. */
  11. var RadialGradient = function (x, y, r, colorStops, globalCoord) {
  12. // Should do nothing more in this constructor. Because gradient can be
  13. // declard by `color: {type: 'radial', colorStops: ...}`, where
  14. // this constructor will not be called.
  15. this.x = x == null ? 0.5 : x;
  16. this.y = y == null ? 0.5 : y;
  17. this.r = r == null ? 0.5 : r; // Can be cloned
  18. this.type = 'radial'; // If use global coord
  19. this.global = globalCoord || false;
  20. Gradient.call(this, colorStops);
  21. };
  22. RadialGradient.prototype = {
  23. constructor: RadialGradient
  24. };
  25. zrUtil.inherits(RadialGradient, Gradient);
  26. var _default = RadialGradient;
  27. module.exports = _default;