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

@jakebeamish/penplotting

v3.1.0

Published

A JavaScript framework for making SVG files for penplotters.

Downloads

259

Readme

Penplotting.js

GitHub Actions Workflow Status

Penplotting.js is a JavaScript framework for making generative art in SVG format for penplotters. This project is a personal project, and as such, it is a work-in-progress. New features and breaking changes are to be expected in future updates. Use at your own discretion, feel free to contribute and raise issues.

Features

  • A Plot class to contain everything needed to create and render the SVG
  • Shapes and geometry classes: 2D Vector, Line, Path, Circle, AABB
  • Seedable PRNG implementations with useful methods
  • Quadtree for optimised nearest-neighbour search
  • Paper sizes

Installation

npm i @jakebeamish/penplotting

Usage

To start a new plot, run

npx new-plot

This will create new default index.html, style.css and plot.js files.

Inside plot.js, adjust the options for initializing the plot:

const plot = new Plot({
    units: "mm",
    title: "My amazing plot",
    size: Paper.A5,
    strokeWidth: 0.05
});

Define a plot.generate() function, in which Vectors, Lines and other shapes can be created, manipulated, and added to the SVG document using plot.add(shapes).

// This is where the work is made
plot.generate = () => {
    // Create Lines from Vectors
    const a = new Vector(10, 10);
    const b = new Vector(90, 90);
    const line = new Line(a, b);

    // Add shapes to the Plot
    plot.add(line);
}

plot.draw();

Calling plot.draw() at the end of the file will generate an SVG element and UI inside index.html, which can be opened in a browser.

Keyboard shortcuts

| Action | Key | |-|-| |Download an SVG file|d| |Regenerate with random seed|r|

Plotting the SVG files

The SVG file can be downloaded and optionally processed further. Personally, I use vpype to optimise the file, and then the axidraw Inkscape plugin to control the plotter.

Contributing

Contributions are welcome. Issues, comments and Pull Requests can be made at https://github.com/jakebeamish/penplot-svg-tool/issues.

The project is tested using jest. Documentation is generated using JSDoc.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Acknowledgements

This project incorporates code from: