@artomata/pentaflower
v1.1.0
Published
## Usage
Downloads
5
Readme
pentaflower
Usage
Install
npm install @artomata/pentaflower
Usage in node
const Pentaflower = require('@artomata/pentaflower')
const myFlower = new Pentaflower({ rings: 50 })
Usage in browser
const Pentaflower = window.Pentaflower
const myFlower = new Pentaflower({ rings: 50 })
Pentaflower API
setState
myFlower.setState(3) // sets the 4th pentagon state to true (i.e. alive)
progress
myFlower.progress() // moves pentaflower to the next state
getDimensions
myFlower.getDimensions() // returns useful info about dimensions of pentaflower
pentagons
See Pentagon API below for more information about the returned objects.
const pentagons = myFlower.pentagons // array of all of the pentagon objects
Pentagon API
points
const points = myFlower.pentagons[0].points // array of point objects
const x = points[0].x
const y = points[0].y
getState
const state = myFlower.pentagons[0].getState() // boolean; true is alive