1. scale-svg-path
Scales an SVG path along its X/Y axes.
scale-svg-path
Package: scale-svg-path
Created by: michaelrhodes
Last modified: Sun, 26 Jun 2022 16:23:38 GMT
Version: 0.0.1
License: MIT
Downloads: 35,190
Repository: https://github.com/michaelrhodes/scale-svg-path

Install

npm install scale-svg-path
yarn add scale-svg-path

scale-svg-path

scale-svg-path scales the position of a parsed SVG path along its X/Y axes. It was extracted from Fontello’s wonderful svgpath toolkit.

Build status

Browser support

Older browsers might require a polyfill for Array.prototype.map.

Install

 $ npm install scale-svg-path

API

 scale(path, sx [, sy]) // sy = sx if undefined

Example

 var parse = require('parse-svg-path')
var scale = require('scale-svg-path')
var serialize = require('serialize-svg-path')

var path = parse('M10 10 L15 15')
var x = scale(path, 0.5)
var xy = scale(path, 0.5, 1.5)

serialize(x)
// => 'M5 5 L7.5 7.5'

serialize(xy)
// => 'M5 15 L7.5 22.5'

License

MIT

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code