How to use the @antv/g-canvas/lib/util/arc-params function in @antv/g-canvas

To help you get started, we’ve selected a few @antv/g-canvas 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 / G2 / src / animate / animation / sector-path-update.ts View on Github external
function getAngle(startPoint: number[], arcPath: PathCommand) {
  let { startAngle, endAngle } = getArcParams(startPoint, arcPath);

  if (!isNumberEqual(startAngle, -Math.PI * 0.5) && startAngle < -Math.PI * 0.5) {
    startAngle += Math.PI * 2;
  }
  if (!isNumberEqual(endAngle, -Math.PI * 0.5) && endAngle < -Math.PI * 0.5) {
    endAngle += Math.PI * 2;
  }

  if (arcPath[5] === 0) {
    // 逆时针,需要将 startAngle 和 endAngle 转置,因为 G2 极坐标系为顺时针方向
    [startAngle, endAngle] = [endAngle, startAngle];
  }

  if (isNumberEqual(startAngle, Math.PI * 1.5)) {
    startAngle = Math.PI * -0.5;
  }

@antv/g-canvas

A renderer implemented by Canvas 2D API

MIT
Latest version published 25 days ago

Package Health Score

89 / 100
Full package analysis