Socket
Socket
Sign inDemoInstall

svg-path-properties

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-path-properties

Calculate the length for an SVG path, to use it with node or a Canvas element


Version published
Maintainers
1
Created

What is svg-path-properties?

The svg-path-properties npm package provides utilities for working with SVG path data. It allows you to compute various properties of SVG paths such as length, point at a given length, tangent angle, and more.

What are svg-path-properties's main functionalities?

Compute Path Length

This feature allows you to compute the total length of an SVG path. The code sample demonstrates how to create an instance of svgPathProperties with a given path and then compute its total length.

const { svgPathProperties } = require('svg-path-properties');
const properties = new svgPathProperties('M10 10 H 90 V 90 H 10 Z');
const length = properties.getTotalLength();
console.log(length);

Get Point at Length

This feature allows you to get the coordinates of a point at a specific length along the path. The code sample shows how to get the point at length 50 on the given path.

const { svgPathProperties } = require('svg-path-properties');
const properties = new svgPathProperties('M10 10 H 90 V 90 H 10 Z');
const point = properties.getPointAtLength(50);
console.log(point);

Get Tangent Angle at Length

This feature allows you to get the tangent angle at a specific length along the path. The code sample demonstrates how to get the tangent angle at length 50 on the given path.

const { svgPathProperties } = require('svg-path-properties');
const properties = new svgPathProperties('M10 10 H 90 V 90 H 10 Z');
const tangent = properties.getTangentAtLength(50);
console.log(tangent);

Get Properties at Length

This feature allows you to get all properties (point, tangent, etc.) at a specific length along the path. The code sample shows how to get all properties at length 50 on the given path.

const { svgPathProperties } = require('svg-path-properties');
const properties = new svgPathProperties('M10 10 H 90 V 90 H 10 Z');
const allProperties = properties.getPropertiesAtLength(50);
console.log(allProperties);

Other packages similar to svg-path-properties

Keywords

FAQs

Package last updated on 02 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc