Add AttractorWidget: GPU-accelerated 2D iterative-map renderer#244
Open
koaning wants to merge 1 commit into
Open
Add AttractorWidget: GPU-accelerated 2D iterative-map renderer#244koaning wants to merge 1 commit into
koaning wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AttractorWidgetrenders 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).magma/viridis/inferno/plasma/grayscaledensity LUTs and ablack/whitebackground are also available. Drag-to-pan and wheel-to-zoom mutate the syncedviewtraitlet, and the render loop auto-pauses when the canvas is off-screen.TangleSliderdrag 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_e2euv run marimo check demos/attractor.pyuv run marimo edit demos/attractor.py: drag sliders, switch formula and theme, pan/zoom the canvas, toggle background between black/white, confirmgrayscaleonwhitereads as ink-on-paper.🤖 Generated with Claude Code