Skip to content

lokesh-coder/blobshape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation


Blobs

Generate unique and fixed shape blobs for web apps

 

Installation

npm i blobshape

Usage

Generate random blob

import blobshape from "blobshape";

const { path, seedValue } = blobshape();
const svg = `<svg viewBox="0 0 100 100"><path d="${path}" /></svg>`;

// seedValue - returns id string, later it can be used to get same shape

Get fixed shape blob

Set seed value to get same fixed shape

import blobshape from "blobshape";

const { path } = blobshape({ seed: "6-6-7171" });
const svg = `<svg viewBox="0 0 100 100"><path d="${path}" /></svg>`;

Config

growth - Minimum size of the blob in percentage. More the smaller more the randomness.

edges - Total nodes to create a shape. Increasing this value will add complexity to the shape.

size - SVG blob path size

import blobshape from "blobshape";

const { path } = blobshape({ size: 300, growth: 6, edges: 6, seed: null });
const svg = `<svg viewBox="0 0 100 100"><path d="${path}" /></svg>`;

Demo

To see live action of this package check blobs.app and you can find the source code for that in github repo.

License

MIT

About

Generate SVG blob shapes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published