https://github.com/walsh9/topiary
🌱🌳 Javascript fractal tree generator
https://github.com/walsh9/topiary
fractal javascript procedural-generation
Last synced: 2 months ago
JSON representation
🌱🌳 Javascript fractal tree generator
- Host: GitHub
- URL: https://github.com/walsh9/topiary
- Owner: walsh9
- License: mit
- Created: 2015-11-02T22:16:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-24T05:28:47.000Z (over 6 years ago)
- Last Synced: 2025-04-16T00:15:56.924Z (2 months ago)
- Topics: fractal, javascript, procedural-generation
- Language: JavaScript
- Homepage: http://walsh9.github.io/topiary-demos/
- Size: 419 KB
- Stars: 13
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# to·pi·ar·y
/ˈtōpēˌerē/noun
1. A shrub or tree clipped or trimmed into fantastic shapes.

## Description
A JavaScript module for creating simple procedurally generated trees.
## Demos
[Tree Generator with Options GUI](http://walsh9.github.io/topiary-demos/generator/index.html)
[Parallax Forest](http://walsh9.github.io/topiary-demos/parallax/index.html)
[Creepy Animated Trees](http://walsh9.github.io/topiary-demos/animation/index.html)## Usage
`npm install @walsh9/topiary --save`
###example.html
```html
```
###example.js
```javascript
var treeOptions = {
canvas: document.getElementById("canvas"),
startPoint: Topiary.Vector2d.new(250, 500),
color: Topiary.Color.random(),
height: 100,
thickness: 10,
depth: 14,
rainbow: false,
colorShiftRate: 30,
delay: 200,
};
var mutationOptions = {
minLeftAngle: 10,
maxLeftAngle: 40,
minRightAngle: 20,
maxRightAngle: 40,
minHeightChange: 0.6,
maxHeightChange: 0.9,
minThicknessChange: 0.6,
maxThicknessChange: 0.9,
};
var tree = Topiary.new(treeOptions, mutationOptions);
tree.draw();
```
## Helpers```javascript
var color1 = Topiary.Color.new(h, s, l);
var color2 = Topiary.Color.random();
var point = Topiary.Vector2d.new(x, y);
```## License
© Matt Walsh 2015-2016, released under the MIT License