Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 1.04 KB

README.md

File metadata and controls

65 lines (43 loc) · 1.04 KB

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