# svg-peak

> Draw a simple svg shape with a peak path

Latest version **0.1.0** (published 2016-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install svg-peak
pnpm add svg-peak
yarn add svg-peak
bun add svg-peak
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-01-27 |
| First published | 2016-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | jeromedecoster |
| Keywords | svg, path, draw, peak |

## Links

- npm: https://www.npmjs.com/package/svg-peak
- Repository: https://github.com/jeromedecoster/svg-peak
- Homepage: https://github.com/jeromedecoster/svg-peak#readme
- Issues: https://github.com/jeromedecoster/svg-peak/issues
- npm.io page: https://npm.io/package/svg-peak

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-01-27

## README

# svg-peak

> Draw a simple svg shape with a peak path

## Install

```bash
npm i svg-peak
```

## API

#### constructor([options])

| Option | Action |
| :------ | :------- |
| **w** | svg width |
| **h** | svg height |
| **d** | direction of the drawing &mdash; top, right, bottom, left |
| **p1** | first point |
| **p2** | second point |

```js
const Peak = require('svg-peak')

var peak = new Peak({p1:10, p2:50, w:100, h:200})

// also allowed
var peak = Peak({p1:10, p2:50, w:100, h:200})

// all options are also accessible via getter/setter
peak.d = 'top'
peak.p1 = 100
```

#### svg()

Return svg node

```js
var peak = Peak({p1:10, p2:50, w:100, h:200})

/*
<svg viewBox="0 0 100 200" preserveAspectRatio="none">
  <path d="M0 0 V10 L50 50 L100 10 V0 z"></path>
</svg>
*/
var svg = peak.svg()
```

#### path()

Return path value

```js
var peak = Peak({p1:10, p2:50, w:100, h:200})

peak.p1 = 20
// M0 0 V20 L50 50 L100 20 V0 z
var path = peak.path()
```

## Demo

```bash
npm i && npm start
```

## Related

- <a href="https://github.com/jeromedecoster/svg-cubic" target="_blank">svg-cubic</a>
- <a href="https://github.com/jeromedecoster/svg-line" target="_blank">svg-line</a>
- <a href="https://github.com/jeromedecoster/svg-quad" target="_blank">svg-quad</a>

## Thanks

Mainly forked / inspired on <a href="http://tympanus.net/codrops/2014/01/07/shape-hover-effect-with-svg" target="_blank">Codrops</a> and <a href="http://cargocollective.com/isaac317" target="_blank">Isaac Montemayor</a>

## License

MIT

---
_Source: https://npm.io/package/svg-peak · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
