Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svg-path-sdf

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-path-sdf

Get signed distance field for a svg path

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
161K
decreased by-12.69%
Maintainers
2
Weekly downloads
 
Created
Source

svg-path-sdf experimental

Create signed distance field for an svg path data.

svg-path-sdf

Usage

npm install svg-path-sdf

let pathSdf = require('svg-path-sdf')

let arr = pathSdf('M40,0A40,40 0 1,1 0,-40A40,40 0 0,1 40,0Z', {
	width: 200,
	height: 200
})

arr has 200×200 elements with value from 0..1 range, corresponding to distance. The path is drawn at the center of the sdf fitting to the minimum side.

distances = pathSdf(path, options|shape?)

OptionMeaning
width,w, height,h or shapeOutput sdf size in px, defaults to 200×200.
cutoff, radiusSDF parameters for bitmap-sdf, by default detected from shape to fit min side.
viewBoxView box for the path data. If not defined, it is detected as path bounds via svg-path-bounds.
strokeWhether to stroke shape. Positive number will stroke outside the amount of pixels, negative number will stroke inside, 0-ish will disable stroke.

License

(c) 2017 Dima Yv. MIT License

Development supported by plot.ly.

Keywords

FAQs

Package last updated on 13 Dec 2018

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