From 2a3e2c03a0865ed56bc043652f896fd01a5f5d8b Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Wed, 21 Aug 2024 09:51:58 +0200 Subject: [PATCH] in-memory hyphae --- hyphae.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hyphae.py b/hyphae.py index 7900db4..31e49d0 100755 --- a/hyphae.py +++ b/hyphae.py @@ -6,7 +6,7 @@ import random from utils import circle_fill from utils import random_color -WIDTH, HEIGHT = 1000, 1000 +WIDTH, HEIGHT = 500, 500 ANGLE_RANDOM_MIN = -0.6 ANGLE_RANDOM_MAX = 0.6 # how much to shrink each consecutive circle @@ -87,7 +87,6 @@ def grow_subs(ctx, subs, branches): for branch in subs: # create a sub branch based on length sub_branches = len(branch.nodes) // 7 * 2 - print(f'creating {sub_branches} subs') if sub_branches > 1: created = True @@ -112,7 +111,7 @@ def grow_subs(ctx, subs, branches): branch.place_next([b for b in branches if b != branch]) return new_subs def main(): - + surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT) ctx = cairo.Context(surface) @@ -143,8 +142,6 @@ def main(): return ctx.set_source_rgb(0.0, 0.0, 0.1*x) subs = grow_subs(ctx, subs, branches) - surface.write_to_png("out/hyphae.png") # Output to PNG - input('next') finally: surface.write_to_png("out/hyphae.png") # Output to PNG