0.2.0 • Published 6 years ago

react-polygon v0.2.0

Weekly downloads
44
License
MIT
Repository
github
Last release
6 years ago

Standard - JavaScript Style Guide Build Status npm version

react-polygon

A react add-on for drawing polygons for any number of sides, as well as animation

Demo

https://peteroid.github.io/react-polygon/

Usage

npm install react-polygon --save
import Polygon from 'react-polygon'

// add this to your components
<Polygon />

Build your own

npm install
npm run webpack

Props

name : propType = defaultValue

Basic

Animation

  • isAnimating : bool = true
  • duration : number = 1000

renderPoint

You can render extra elements on each point by passing a function to the props renderPoint. Here is an example for rendering a point on each vertice:

import React, { Component } from 'react'
import Polygon from 'react-polygon'

class MyPolygon extends Component {
  myRenderPoint (point) {
    return (
      <circle cx={point[0]} cy={point[1]} r={5} />
    )
  }
  
  render () {
    return (
      <Polygon renderPoint={this.myRenderPoint} />
    )
  }
}
0.2.0

6 years ago

0.1.0

7 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago