Ring.js 485 B

1234567891011121314151617181920212223242526
  1. var Path = require("../Path");
  2. /**
  3. * 圆环
  4. * @module zrender/graphic/shape/Ring
  5. */
  6. var _default = Path.extend({
  7. type: 'ring',
  8. shape: {
  9. cx: 0,
  10. cy: 0,
  11. r: 0,
  12. r0: 0
  13. },
  14. buildPath: function (ctx, shape) {
  15. var x = shape.cx;
  16. var y = shape.cy;
  17. var PI2 = Math.PI * 2;
  18. ctx.moveTo(x + shape.r, y);
  19. ctx.arc(x, y, shape.r, 0, PI2, false);
  20. ctx.moveTo(x + shape.r0, y);
  21. ctx.arc(x, y, shape.r0, 0, PI2, true);
  22. }
  23. });
  24. module.exports = _default;