A 3D playground built with Babylon.js through the
WebSharper.BabylonJs bindings
and compiled from F# to JavaScript with WebSharper.
- An
Enginewith anArcRotateCameraorbiting a target, and aHemisphericLight+DirectionalLightpair with aShadowGenerator. - A gallery of twelve
MeshBuildershapes — box, sphere, ground, cylinder, torus, torus knot, ico sphere, capsule, disc, tube, ribbon and a lathe. - A
DynamicTexturedrawn through itsCanvasRenderingContext2D. - Pointer picking through
scene.onPointerObservable. - Live edits of materials, lights, the render loop and the scene lifecycle.
- A
Vector3/Color3/Matrix/Quaterniontour in the “API tour” card. - A light/dark theme switcher persisted in
localStorage.
The F# source is src/Client.fs; the whole page is the template in
src/index.html, bound with Template<...> and .Bind(). All presentational
styling lives in src/site.css.
BabylonJS/
src/
Client.fs # template binding, scene, UI state
BabylonJS.fsproj
index.html # the page template
site.css
wsconfig.json
package.json
esbuild.config.mjs # bundles @babylonjs/core + the WebSharper output
docs/screenshot.png
.github/workflows/deploy.yml
cd src
npm install
dotnet build -c Release
The Release build also runs esbuild and writes the static site to dist/.
Serve it with any static file server and open the URL:
cd dist
python3 -m http.server 8099 --bind 127.0.0.1
Every push to main builds in Release and publishes dist/ to the gh-pages
branch.
