Skip to content

Add AttractorWidget: GPU-accelerated 2D iterative-map renderer#244

Open
koaning wants to merge 1 commit into
mainfrom
koaning/clifford-attractor-widget
Open

Add AttractorWidget: GPU-accelerated 2D iterative-map renderer#244
koaning wants to merge 1 commit into
mainfrom
koaning/clifford-attractor-widget

Conversation

@koaning

@koaning koaning commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • New AttractorWidget renders Clifford, De Jong, or any user-supplied 2D iterative-map formula entirely on the JS side — Python only ships scalar parameters, so slider drags don't round-trip a million points. WebGL2 pipeline with a Canvas2D fallback (badge in the corner shows which is active).
  • Coloring uses Ricky Reusser's per-iteration-distance phase scheme by default; magma / viridis / inferno / plasma / grayscale density LUTs and a black / white background are also available. Drag-to-pan and wheel-to-zoom mutate the synced view traitlet, and the render loop auto-pauses when the canvas is off-screen.
  • TangleSlider drag updates switch from debounce to a 50 ms throttle so reactive widgets re-render live as the user scrubs, not just on release.

Test plan

  • uv run pytest tests/ -x --ignore=tests/test_e2e
  • uv run marimo check demos/attractor.py
  • uv run marimo edit demos/attractor.py: drag sliders, switch formula and theme, pan/zoom the canvas, toggle background between black/white, confirm grayscale on white reads as ink-on-paper.

🤖 Generated with Claude Code

Renders Clifford, De Jong, or any user-supplied formula entirely on the
JS side so Python only sends scalar parameters. WebGL2 pipeline with a
Canvas2D fallback. Drag to pan, scroll to zoom; the view stays in sync
with Python. Coloring follows Ricky Reusser's per-iteration-distance
phase scheme by default, with magma / viridis / inferno / plasma /
grayscale density LUTs also selectable. The render loop pauses when the
canvas is off-screen so multiple widgets don't compete for the main
thread. TangleSlider drag updates also switch from debounce to throttle
so reactive widgets re-render live as the user scrubs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant