npm.io
1.0.1 • Published 10 years ago

floweroflife

Licence
MIT
Version
1.0.1
Deps
0
Vulns
0
Weekly
0

floweroflife.js

This script generates a set of points ( circle centers ) which form the mystical flower of life pattern.

Install:

npm/bower install floweroflife

Usage:

var flower = require("floweroflife");
var radius = 40;
var layers = 4;
// Generate 4 layers, starting from x0,y0
var f = flower(0,0 , radius, layers);

f.layers(); // Returns 2d array of layered points
f.points(); // Returns array of all flower points ( layers flattened )
            // Each point is: Object { x: 0, y: 0 }

Here is a jsfiddle demo that uses snap.svg to draw the pattern. Use any drawing library of your choice and create your flower.

Keywords