Conversation
This is basically the wasm-pack demo.
Embeds xilem_web into the blog, does counter demo.
The idea is that these should be generated by CI, but that's not in place just yet.
This should build the WASM for the Rust code, but hasn't been validated. At least the check build should work on PR upload.
Contributor
Author
|
Ok, I've now added CI, which does successfully build the wasm, but the deployment is not tested. It looks like wasm-bindgen is sufficient, I don't think the wasm-pack wrapper is actually needed. |
raphlinus
added a commit
that referenced
this pull request
Sep 21, 2026
Adds a wiki page comparing four squircle constructions, with an embedded xilem_web demo for exploring them, following the approach prototyped in #131. Demos live in a crates/ workspace, matching the layout already used on the log-aesthetic branch. Each is a cdylib exporting start(id), which wasm-bindgen packages into static/rust/ for the page to import and mount. Each also has a bin target so `trunk serve` still works for local iteration against that same entry point; site builds pass --lib, so it is never compiled in CI. crates/build.sh is what both the deploy workflow and local use beside `zola serve` run, so the two cannot drift. It builds only the crates that declare a cdylib, so native tools that share this workspace are never compiled for wasm. The tester is ported from a standalone prototype, with the formatting reworked for embedding: the radios and the zoom toggle are labelled, the curvature profile moved out of the shape's coordinate space into its own panel, the SVGs carry a viewBox instead of fixed pixel sizes so they reflow, and stroke colors come from CSS custom properties so the demo follows the site's light and dark themes. Two fixes to the ported math: Superellipse::curvature_profile swept only a half quadrant, while the other constructions sweep a full one, so selecting it silently halved the plot's arc length axis. render_profile now drops non-finite samples and breaks the polyline across the gap. At the bottom of the gauge range the Figma corner collapses to a cubic whose first three control points coincide, making its curvature 0/0, and a single NaN makes a browser reject the whole SVG path.
This branch has not been deployed
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.
This adds a very basic xilem-web integration into the blog. Currently I'm using
wasm-pack --target webto build the wasm, then copying rust_demo{.js,_bg.wasm} into static/rust. These steps would be done by CI.Note that the Vello web demo is a bit similar. It uses wasm-bindgen directly, and that might be more lightweight; in this case, it's likely wasm-pack is a pretty thin layer around it.
This branch currently has no interesting content. The plan is to import the interactive demo from raphlinus/fast-stroke, along with nicer UI for controlling the experiments (currently, my main workflow is editing the code).