aframe-lsystem-component
Version:
L-System/LSystem component for A-Frame to draw 3D turtle graphics. Using Lindenmayer as backend.
33 lines (25 loc) • 1.21 kB
HTML
<html>
<head>
<title>A-Frame L-System Component - Tree</title>
<script src="../libs/aframe.js"></script>
<script src="../libs/aframe-lsystem-component.js"></script>
<style media="screen">
body {
background-color: #94bfcf;
}
</style>
</head>
<body>
<a-scene>
<a-assets>
<a-mixin id="yellow" material="color: yellow;"></a-mixin>
<a-mixin id="green" material="color: #528e1e;"></a-mixin>
<a-mixin id="brown" material="color: #877504;"></a-mixin>
<a-mixin id="line" geometry="primitive: cone; height: 2; radiusBottom: 1; radiusTop: 0.66; segmentsRadial:5; segmentsHeight:3" ></a-mixin>
<a-mixin id="flower" geometry="primitive: sphere; radius: 1; segmentsWidth:6; segmentsHeight: 6"></a-mixin>
</a-assets>
<a-entity scale="2 2 2" position="0 -8 -12" rotation="0 45 0" lsystem="axiom: F!F!X; productions: X:FX[+!XF'][--!F+/X'][&!FXFX!F''][^!FX!F'']; segmentMixins: F:brown line,brown line,brown line,brown line,green line,green line,green line,yellow flower; angle: 60; iterations: 5; scaleFactor: 0.666">
</a-entity>
</a-scene>
</body>
</html>