Droplet.js 571 B

123456789101112131415161718192021222324252627
  1. var Path = require("../Path");
  2. /**
  3. * 水滴形状
  4. * @module zrender/graphic/shape/Droplet
  5. */
  6. var _default = Path.extend({
  7. type: 'droplet',
  8. shape: {
  9. cx: 0,
  10. cy: 0,
  11. width: 0,
  12. height: 0
  13. },
  14. buildPath: function (ctx, shape) {
  15. var x = shape.cx;
  16. var y = shape.cy;
  17. var a = shape.width;
  18. var b = shape.height;
  19. ctx.moveTo(x, y + a);
  20. ctx.bezierCurveTo(x + a, y + a, x + a * 3 / 2, y - a / 3, x, y - b);
  21. ctx.bezierCurveTo(x - a * 3 / 2, y - a / 3, x - a, y + a, x, y + a);
  22. ctx.closePath();
  23. }
  24. });
  25. module.exports = _default;