How to use the @antv/path-util.catmullRom2Bezier function in @antv/path-util

To help you get started, we’ve selected a few @antv/path-util 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 / G6 / src / util / path.ts View on Github external
export const getSpline = (points: IPoint[]) => {
  const data: number[] = [];

  if (points.length < 2) {
    console.warn(`point length must largn than 2, now it's ${points.length}`);
  }
  for (const point of points) {
    const { x, y } = point;
    data.push(x);
    data.push(y);
  }

  const spliePath = catmullRom2Bezier(data);
  spliePath.unshift(['M', points[0].x, points[0].y]);
  return spliePath;
};
github antvis / G2 / packages / component / src / axis / helix.ts View on Github external
getLinePath() {
    const crp = this.get('crp');
    const axisStart = this.get('axisStart');
    const path = pathUtil.catmullRom2Bezier(crp);
    path.unshift([ 'M', axisStart.x, axisStart.y ]);
    return path;
  }

@antv/path-util

A common util collection for antv projects

MIT
Latest version published 3 years ago

Package Health Score

63 / 100
Full package analysis