package
A performant 3D JavaScript library built for WebGPU and WebGL2.
npm install leafGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
deondree
deondreenglish45@gmail.com
Estimated unpacked size across 7 packages.
5.7 MB
Includes dependencies.
4 direct · 1 outdated
Leaf‑js is a next‑generation 2D/3D rendering engine for creating games, simulations, and interactive experiences directly on the web. It builds upon modern browser graphics technologies—primarily WebGPU—to simplify the development of complex, high‑performance 3D environments.
Leaf’s ultimate goal is to make web‑based games as capable as native desktop or console titles, while also improving asset sharing workflows for industries that rely on advanced visualization (architecture, simulation, VFX, etc.).
Note: WebGPU is currently experimental. It must be enabled manually in your browser settings (e.g., chrome://flags in Chrome). Note: Memory usage is currently a limiting factor—Web‑based GPUs are improving but still constrained compared to native APIs.
Leaf is designed around one core philosophy: power and simplicity should coexist.
Creating a high‑fidelity 3D world shouldn’t require pages of boilerplate boilerplate WebGL code. Leaf builds an abstract rendering layer that intelligently handles low‑level GPU optimization while keeping your experience as modern and developer‑friendly as possible.
These systems are designed to integrate tightly, providing smooth coordination between rendering, physics, lighting, and animation—targeting true high frame‑rate realism (~1080p at 120 FPS).
Advanced Lighting & Rendering
Physics‑Based Interactions
High-Performance Optimization:
Extensible Plugin System:
Unified Scene Management: 2D and 3D scenes live within the same runtime hierarchy.
Dynamic Parsing: Supports OBJ, STL, FBX, and YAML scene definitions.
Cross‑Context Rendering: Auto‑selects WebGPU → WebGL2 → Canvas fallback.
Physics Integration: Lightweight PhysicsSystem supports gravity, collision, and rigid body mechanics.
Profiler & Debugger: Collects FPS, vertex counts, and bounding data directly from GPU passes.
Declarative Scene API: Scenes can be defined via TypeScript objects for clarity and composability.
Web‑Component Canvas: Leaf provides a default <leaf‑canvas> element supporting all rendering contexts.
🧪 Prototype concept — not yet implemented.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Leaf ESM Public Test</title>
<style></style>
</head>
<body>
<canvas
is="leaf-js"
src="initScene"
width="800"
| Principle | Description |
|---|---|
| Declarative First | Describe what you want rendered — Leaf handles how. |
| Low‑Level Access | When Needed Direct access to pipelines or buffers is always possible. |
| Zero‑Boilerplate Startup | Leaf.scene() should be enough to start a new environment. |
| Native‑Quality Web Performance | Aim for full parity with desktop APIs like Vulkan/DirectX. |
| Open Design | Engine internals are modular, making extension and experimentation easy. |
| Domain | Formats |
|---|---|
| 3D Models | FBX, OBJ, STL |
| 2D Assets | PNG, JPEG, GIF, SVG |
| Sprite Systems | Aseprite (.ase, .aseprite) |
| Scene | Definitions YAML |
Leaf‑js strives to make high‑fidelity, physics‑enabled, real‑time 3D simulations accessible on the Web—
bridging the power of native rendering with the openness of browser platforms.
It’s not just another WebGL wrapper — it’s the beginning of the WebGPU era.