1.1.0 • Published 4 years ago

@joshwilkerson/react-trianglify v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

React-Trianglify

Installation

npm install --save @joshwilkerson/react-trianglify

Props

PropTypeDefaultNotes
widthnumber500Specify the width in pixels of the pattern to generate.
heightnumber300Specify the height in pixels of the pattern to generate.
cellSizenumber50Specify the size in pixels of the mesh used to generate triangles.
variancenumber0.75Decimal value between 0 and 1. Specify the amount of randomness used when generating triangles.
seedstringnullSeeds the random number generator to create repeatable patterns.
xColorsfalse, string or array of CSS-formatted colors"random"Valid string values are 'random', or the name of a colorbrewer palette (i.e. 'YlGnBu' or 'RdBu'). When set to 'random', a gradient will be randomly selected from the colorbrewer library. Valid array values should specify the color stops in any CSS format (i.e. '#000000', '#4CAFE8', '#FFFFFF').
yColorsFalse, string or array of CSS-formatted colors"match"When set to 'match' the x-axis color gradient will be used on both axes. Otherwise, accepts the same options as xColors.
colorSpacestring"lab"Supported values are rgb, hsv, hsl, hsi, lab and hcl.
fillbooleantrueSpecifies whether the polygons generated by Trianglify should be filled in.
strokeWidthnumber0Specify the width of the strokes used to outline the polygons.
classNamestring" "append classes to SVG wrapper div

Example

import React from "react";
import Trianglify from "@joshwilkerson/react-trianglify";

function App() {
  return (
    <Trianglify height={200} width={350} variance={0.5} />
  )
}

export default App;