基于CFDG的开罗Python生成艺术框架
contextfree的Python项目详细描述
CFDG-灵感来源于开罗的Python生成艺术工具
下面是一个生成随机分形树的简单代码示例:
fromcontextfree.contextfreeimport*@check_limitsdefbranch():line(0,1)withtranslate(0,0.9):withscale(0.7+rnd(0.15)):withcolor(alpha=0.95):withrotate(-0.3+rnd(0.3)):branch()withrotate(0.3+rnd(0.3)):branch()init(canvas_size=(300,300),background_color="#FFFFFF")withscale(3):branch()display_ipython()
输出如下:
查看示例文件夹以获取更多有趣的内容。
我该怎么做?
- pip3 install contextfree用于最新的稳定版本
- pip3 install git+https://github.com/undertherain/pycontextfree.git用于最新的开发版本
- python 3.6或更高版本是必需的