![](/style/images/good.png)
![](/style/images/bad.png)
GitHub - genbs/urpflanze: A library for developers who want to approach to creat...
source link: https://github.com/genbs/urpflanze
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
A library for developers who want to approach to creative coding, for artists who want to approach to programming or for anyone else who wants to play with math.
Installation
The most immediate way to include Urpflanze in your project is to use an online hosted version.
Full version
<script src="https://cdn.jsdelivr.net/npm/urpflanze"></script>
Customizable version
<script src="https://cdn.jsdelivr.net/npm/urpflanze[@version]/build/urpflanze[-light][.min].js"></script>
To install it just run the command:
npm i --save urpflanze
At the end you can include Urpflanze in your code
import * as Urpflanze from 'urpflanze' const scene = new Urpflanze.Scene() // or import { Scene } from 'urpflanze' const scene = new Scene()
use urpflanze/dist/index-light
for light version
Example
Hello Rect!
const scene = new Urpflanze.Scene() const rect = new Urpflanze.Rect({ repetitions: 8, distance: 100, sideLength: 20, }) scene.add(rect) // Add rect to scene const drawer = new Urpflanze.DrawerCanvas(scene, document.body) drawer.draw() // Draw scene on canvas
Output
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK