CFDG-inspired cairo-based pythonic generative art tool
Here is an example of simple code producing stochastic fractal tree:
from contextfree.contextfree import *
@check_limits
def branch():
line(0,1)
with translate(0,0.9):
with scale(0.7 + rnd(0.15)):
with color(alpha=0.95):
with rotate(-0.3 + rnd(0.3)):
branch()
with rotate(0.3 + rnd(0.3)):
branch()
init(canvas_size=(300,300), background_color="#FFFFFF")
with scale(3):
branch()
display_ipython()
Here is the output:
Check examples folder for more fun stuff.
pip3 install contextfree
for latest stable releasepip3 install git+https://github.com/undertherain/pycontextfree.git
for recent development version- Python 3.6 or later is required