Flowing Curves & Waves¶
Create organic, flowing compositions using curves, custom paths, and line art.
Curve Field¶
Vary curvature by position for a rippling effect:
for cell in scene.grid:
nx, ny = cell.normalized_position
curvature = math.sin(nx * math.pi * 2 + ny * math.pi) * 0.7
cell.add_curve(
start="left", end="right",
curvature=curvature,
width=0.5 + ny * 2,
color=colors.primary,
opacity=0.3 + nx * 0.6,
)
Wave Visualization¶
Stack the built-in Path.Wave with growing amplitude and frequency — relative=True lets you place it in 0–1 cell coordinates:
cell = scene.grid[0][0]
for i in range(8):
wave = Path.Wave(start=(0.05, 0.5), end=(0.95, 0.5),
amplitude=0.04 + i * 0.025, frequency=2 + i * 0.5)
color = colors.primary if i % 2 == 0 else colors.secondary
cell.add_path(wave, relative=True, width=1.5, color=color, opacity=0.8 - i * 0.08)
Spiral Paths¶
A custom spiral rendered in each cell:
Image Curves¶
Overlay curves on a photograph — curvature driven by brightness:
scene = Scene.from_image("MCEscherBirds.jpg", grid_size=60, cell_size=10)
for cell in scene.grid:
if cell.brightness > 0.15:
curvature = (cell.brightness - 0.5) * 1.5
cell.add_curve(
start="bottom_left", end="top_right",
curvature=curvature,
width=0.5 + cell.brightness * 2,
color=cell.color,
opacity=0.4 + cell.brightness * 0.5,
)
Cross-Hatching¶
Layer perpendicular lines with position-driven weight: