npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

points.js

v1.1.6

Published

Fast & Lightweight SVG Shape Manipulation library based on Points

Downloads

19

Readme

points.js

Fast & Lightweight SVG Shape Manipulation library based on Points (@colinmeinke/points)

NPM Greenkeeper badge Scrutinizer Scrutinizer Coverage NPM Version Build Status NPM Downloads Github Releases jsdelivr unpkg npmcdn Flattr this license

Note

  • Please use these methods before tweening initializing, because it changes the points for better natural look
  • This is extended version of Points

CDN

# unpkg
https://unpkg.com/points.js

# npmcdn
https://npmcdn.com/points.js

# jsDelivr
https://cdn.jsdelivr.net/npm/points.js

Installing

$ npm install points.js
# or
$ yarn install points.js

Docs

More information about other methods, see Points
Those functions does almost everything what you need, but sometimes hand-made changes required

autoNormalise

What it does?

It normalises your path data segments (curves, points, length, types) based on your from and to shapes.

Code
let [newFromShape, newToShape] = autoNormalise(fromShape, toShape); // Returns normalised path that equalised subpaths or path

autoReverse

What it does?

It determines the when firstShape should be reversed and reverses when necessary

Code
fromShape = autoReverse(fromShape, toShape);

autoIndex

What it does?

It finds closer and best index from fromShape closer to toShape and moves/changes/shifts fromShape points

Code
fromShape = autoIndex(fromShape, toShape);

autoCurve

What it does?

It compares two fromShape and toShape, when some point was mismatching, tries to normalise for correct work (line->curve)

Code
let [newFromShape, newToShape] = autoCurve(fromShape, toShape);

autoOptimize

What it does?

It converts Points object list to Array arrays list for future changing or controlling (for best performance) or for readable format when necessary

Code
let [newFromShape, newToShape] = autoOptimize(fromShape, toShape); // [['M', 10, 20], ['L', 50, 60]] - easier to tween, read and cleaner

splitAt

What it does?

Split the single-path to multi-path (sub-paths). (BETA, improvements would be nice)

Code
let subPaths = splitAt(fromShape, 0.3); // Split into 3-subpaths based on (1 / t:0.3)

autoFix

What it does?

Points.js#autoNormalise + when tweening/interpolation becomes ugly, it provides simple and fast solution for you

Code
let [newFromShape, newToShape] = autoFix(fromShape, toShape); // Returns normalised path that equalised subpaths with index matching