
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
svg-path-generator
Advanced tools
use with node or in browser with browserify
npm install svg-path-generator
var Path = require('svg-path-generator');
var path = Path()
.moveTo(10, 25)
.lineTo(10, 75)
.lineTo(60, 75)
.lineTo(10, 25)
.end();
console.log(path) // M 10 25 L 10 75 L 60 75 L 10 25
to use relative coordinates, call .relative()
before any method
e.g.
var Path = require('svg-path-generator');
var path = Path()
.moveTo(10, 25)
.relative().lineTo(0, 50)
.relative().lineTo(50, 0)
.relative().lineTo(-50, -50)
.end();
console.log(path) // M 10 25 l 0 50 l 50 0 l -50 -50
both paths are equivalent.
moveTo(x, y)
Path.moveTo(x1, y1, x2, y2)
is equivalent to Path.moveTo(x1, y1).moveTo(x2, y2)
lineTo(x, y)
horizontalLineTo(x)
verticalLineTo(y)
curveTo(x1, y1, x2, y2, x, y)
smoothCurveTo(x2, y2, x, y)
bezierCurveTo(x1, y1, x, y)
smoothBezierCurveTo(x, y)
ellipticalArc(rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y)
close()
.relative()
call before any method to have the method accept relative instead of absolute coordinates.end()
converts the Path object to a string. This also gets called on the .toString()
methodMIT
FAQs
Easily generate svg path strings
The npm package svg-path-generator receives a total of 804 weekly downloads. As such, svg-path-generator popularity was classified as not popular.
We found that svg-path-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.