svg-path-interpolator
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -9,3 +9,5 @@ { | ||
"roundToNearest": 0.25, | ||
"sampleFrequency": 0.001 | ||
"sampleFrequency": 0.001, | ||
"pretty": false, | ||
"prettyIndent": 0 | ||
} |
{ | ||
"author": "Justin Wilaby", | ||
"name": "svg-path-interpolator", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
"main": "src/index.js" | ||
} |
@@ -9,9 +9,11 @@ # SVG Path Interpolator | ||
"files": [ | ||
"sample.svg" | ||
"sample.svg" | ||
], | ||
"outputDirectory": "out/", | ||
"trim": false, | ||
"trim": true, | ||
"minDistance": 0.5, | ||
"roundToNearest": 0.25, | ||
"sampleFrequency": 0.001 | ||
"sampleFrequency": 0.001, | ||
"pretty": false, | ||
"prettyIndent": 0 | ||
} | ||
@@ -31,3 +33,10 @@ ``` | ||
### sampleFrequency | ||
`sampleFrequency` determines the increment of `t` when sampling. If `sampleFrequency` is set to `.001` ,since `t` iterates from 0 to 1, there will be 1000 points sampled per command but only points that are greater than `minDistance` | ||
`sampleFrequency` determines the increment of `t` when sampling. If `sampleFrequency` is set to `.001` , since `t` iterates from 0 to 1, there will be 1000 points sampled per command but only points that are greater than `minDistance` are captured. | ||
### pretty | ||
When `true`, `pretty` creates formatted json output | ||
### prettyIndent | ||
Then number of spaces to indent when `pretty` is `true` | ||
## Examples | ||
### Animating output | ||
See [this pen](https://codepen.io/justinwilaby/pen/dMQdBo) for an example on animating a simple path. |
@@ -16,2 +16,4 @@ "use strict"; | ||
let sampleFrequency; | ||
let pretty; | ||
let prettyIndent; | ||
@@ -50,2 +52,4 @@ function read(file) { | ||
outputDirectory = config.outputDirectory; | ||
pretty = !!config.pretty; | ||
prettyIndent = ~~config.prettyIndent; | ||
@@ -65,3 +69,3 @@ if (outputDirectory) { | ||
promises[i] = read(file).then(processPaths).then(interpolatedPaths => { | ||
const jsonStr = JSON.stringify(interpolatedPaths, 2); | ||
const jsonStr = JSON.stringify(interpolatedPaths, null, (pretty ? prettyIndent : 0)); | ||
if (outputDirectory) { | ||
@@ -68,0 +72,0 @@ fs.writeFile(path.normalize(`${outputDirectory}/${fileInfo.name}.pathData.json`), jsonStr); |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
119334
6630
41
1