@nealrame/react-l-system

0.1.0 • Public • Published

@nealRame/react-l-system

An implementation of Lindenmayer Systems for your React application.

Installation

> npm install @nealrame/react-l-system

Example

import * as React from "react"

import { LSystemSVGRenderer } from "@nealrame/l-system"

const app = () => {
    return <LSystemSVGRenderer
        axiom={["F", "-", "-", "F", "-", "-", "F"]}
        productionRules={{
            "F": ["F", "+", "F", "-", "-", "F", "+", "F"],
        }}
        renderingRules={{
            "F": ["forward", 1],
            "+": ["turn",  Math.PI/3],
            "-": ["turn", -Math.PI/3],
        }}
        steps="4"
        backgroundColor="#171717"
        strokeColor="#7ae4ff"
    />
}

Which should produce something like :

Package Sidebar

Install

npm i @nealrame/react-l-system

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

14.7 kB

Total Files

23

Last publish

Collaborators

  • nealrame