I recently discovered Lindenmayer systems, which I find very interesting not only for performing some kind of procedural graphics but also for creating levels. And as now with the quarantine I have plenty of time …
In this demo, self-replicating (fractal) forms are rendered. To do this, it uses the LsPointsGenerator class, which converts a Lindenmayer string into a map of suitable points for rendering, also adding random factors in the system.
Repository demo: https://github.com/jjcapellan/ls-points-generator/tree/master/demo
Repository LsPointsGenerator: https://github.com/jjcapellan/ls-points-generator
About the demo:
I used a graphics object to make the lines of different thickness and colors between each point and its ancestor, but I couldn’t use the lineGradientStyle method to get a gradient between points since it didn’t appear when generating the texture (using generateTexture ()). It seems that it is a problem of difficult solution.
The memory consumption of an ls-system increases in geometric proportion with each iteration, so it is essential to previously calculate the number of points that will be generated in order to reduce the number of iterations if necessary before generating the map. I learned this lesson the hard way.
I hope you like it.