Skip to content

hughsk/svg-line-curved

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svg-line-curved

Generate the path attribute for a curved SVG line between two points:

svg-line-curved

Usage

NPM

path = curve(x1, y1, x2, y2)

Returns a path attribute for the line between (x1, y1) and (x2, y2).

For example:

var createSVG = require('svg-create-element')
var curved = require('svg-line-curved')
var path = createSVG('path')

path.setAttribute('d', curved(0, 0, 100, 100))

path = curve.vertical(x1, y1, x2, y2)

Equivalent to curve(x1, y1, x2, y2), but curving with a vertical bias instead of a horizontal one.

Here's an example screenshot of horizontal and vertical curves respectively:

horizontal vertical

License

MIT. See LICENSE.md for details.

See Also

About

Generate the path attribute for a curved SVG line.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published