Convert JS Array Into An SVG Path – bitmask-to-svg

Category: Image , Javascript | March 19, 2023
Author:Pictogrammers
Views Total:419 views
Official Page:Go to website
Last Update:March 19, 2023
License:MIT

Preview:

Convert JS Array Into An SVG Path – bitmask-to-svg

Description:

bitmask-to-svg is a JavaScript library for creating scalable vector graphics from your data. It works by converting a JS 1D or 2D array into an SVG path, with configurable height, width, scale size, and X/Y offsets.

How to use it:

1. Install and import the bitmask-to-svg.

# NPM
$ npm i @pictogrammers/bitmask-to-svg
import bitmaskToPath from '@pictogrammers/bitmask-to-svg';

2. Convert the data you provide into an SVG path.

const myData = [
      // data here
];
const path = bitmaskToPath(myData);

3. Available options to config the SVG path.

const path = bitmaskToPath(myData, {
      width: undefined,
      height: undefined,
      scale: 1,
      offsetX: 0,
      offsetY: 0,
});

Changelog:

03/20/2023

  • Fixed typo

You Might Be Interested In:


Leave a Reply