How to use the @antv/g.Circle function in @antv/g

To help you get started, we’ve selected a few @antv/g examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2Plot / src / plots / liquid / geometry / shape / liquid.ts View on Github external
const cy = 0.5;
    let sumX = 0;
    let minX = Infinity;
    _.each(cfg.points, (p: any) => {
      if (p.x < minX) {
        minX = p.x;
      }
      sumX += p.x;
    });
    const cx = sumX / cfg.points.length;
    const cp = this.parsePoint({ x: cx, y: cy });
    const minP = this.parsePoint({ x: minX, y: 0.5 });
    const xWidth = cp.x - minP.x;
    const radius = Math.min(xWidth, minP.y);
    const attrs = getFillAttrs(cfg);
    const clipCircle = new Circle({
      attrs: {
        x: cp.x,
        y: cp.y,
        r: radius,
      },
    });
    addWaterWave(
      cp.x,
      cp.y,
      1 - cfg.points[1].y, // cfg.y / (2 * cp.y),
      1,
      [attrs.fill],
      container,
      clipCircle,
      radius * 4
    );
github antvis / G6 / src / shape / nodes / image.js View on Github external
drawClip(cfg, shape) {
    const clip = Util.mix({}, this.options.clipCfg, cfg.clipCfg);

    if (!clip.show) {
      return;
    }
    // 支持circle、rect、ellipse、Polygon及自定义path clip
    const { type, x, y } = clip;
    let clipShape = null;
    if (type === 'circle') {
      const { r } = clip;
      clipShape = new G.Circle({
        attrs: {
          r,
          x,
          y
        }
      });
    } else if (type === 'rect') {
      const { width, height } = clip;
      clipShape = new G.Rect({
        attrs: {
          x,
          y,
          width,
          height
        }
      });