SDK reference
The complete API reference for le.codes projects. Everything here is an import-free global —
user code references Scene, Sprite, UIScreen, fetch, … directly; the build injects the
implementation and tree-shakes what a project doesn't use.
Start with conventions.md — units, coordinate systems, value semantics, and the
lifecycle rules every page assumes. Host-provided globals (setLoop, timers, asset(), …) are in
globals.md.
Guides and worked examples are a separate, future section; this reference documents the API surface only.
The whole surface at a glance
One line per global. Bold = the page that documents it.
Host globals — globals.md
setLoop/clearLoop— per-frame loop;dtin secondssetTimeout/setInterval/clearTimeout/clearInterval— timers (ms)console— log / warn / info / errorasset()— compile-time macro: project file path → bundled resource URLDEG2RAD/RAD2DEG— compile-time angle constantsStyle<T>— editor-only helper type for reusable UI style objects
Math — math/
Mathf— scalar helpers: clamp, lerp, damp, remap, random — mathf.mdVec2,Vec3— fluent vectors; mutable fields, pure methods, tuple-interop — vectors.mdQuat— rotations: fromEuler, fromAxisAngle, slerp, lookRotation — quat.mdMat4— 4×4 matrix: compose/decompose, lookAt, perspective; raw.mexposed — mat4.mdColor— parse/convert anyColorInputform — color.md
Core — core/
Aspect— attachable node capabilities;node.aspect(Class, opts), update phases — aspects.mdsignal,computed,effect— reactive state;() => valuebindings in UI text/styles — signals.mdCanvas,Bitmap— retained 2D drawing that bakes to textures (2D/3D/UI) — canvas.md- event emitter pattern (
addEventListener) shared by scenes/nodes/players — events.md
Runtime — runtime/
device— platform, language, size, pixelRatio, resize event, precise touch — device.mdInput— keyboard polling (Input.key(code)) — input.mdClickEvent,TouchStartEvent— pointer events +ev.track()drags — touch.mdfetch,fetchLocal,FormData,File— HTTP over the host; sync body reads — network.mdWebSocket— browser-like sockets + custom headers — network.mdlocalStorage— persistent key/value strings — storage.mdAudioPlayer,VideoPlayer— media playback; video-as-texture — media.mdopenFilePicker,share— file picking, native share sheet — files-share.mdtoast,SvgSource— native toast; SVG-as-image-source — misc.mddate— dayjs-style dates: format, relative time, arithmetic, comparison (English + Russian) — datetime.md
Animation — animate/
animate,animateMat4,stopAnimation,pauseAnimation,resumeAnimation— value tweens (duration in ms) — animate.mdeaseIn,easeOut,easeInOut,cubicBezier— easing functions — easings.md
2D engine — 2d/
Scene2D— 2D world: background, layers, Y-sort, picking — scene2d.mdNode2D— base node: transform, hierarchy, events — node2d.mdCamera2D— position, zoom, screen↔world (viascene.camera) — camera2d.mdSprite— textured node; frames, tint, flip — sprite.mdSpriteAnimation— sprite-sheet clips aspect (node.anim) — sprite-animation.mdShape2D,Physics2D,Trigger2D,CharacterController2D— Box2D bodies, sensors, queries — physics2d.mdTilemap— atlas tile grid, natively culled — tilemap.mdTexture2D— 2D image loading — texture2d.md
3D engine — 3d/
Scene— 3D world: IBL, bloom, skybox, overlays — scene.mdARScene— AR session: anchors, placement controls — arscene.mdNode— base node: transform, hierarchy, events — node.mdCamera— fov, rays, view direction (viascene.camera) — camera.mdMesh— box/sphere/cylinder/plane factories + custom geometry — mesh.mdModel,ModelAnimation— GLB loading; clip playback (model.anim) — model.mdGeometry— raw vertex data — geometry.mdMaterial— lit/unlit/custom shader materials — material.mdTexture— 3D material image (not interchangeable withTexture2D) — texture.mdLight—Light.sun()directional light + shadows (ambient comes from scene IBL) — light.mdShape,Physics,Trigger,CharacterController— Jolt bodies, sensors, raycasts — physics.mdParticles,dynamic,dynamicColor— GPU particle systems — particles.mdRay,Plane,Noise— picking & procedural helpers — ray-plane-noise.mddefineScene,use— scenes as data (.scene.tsfiles, the scene-editor format) — scene-files.md
UI — ui/
- element model: factories, chaining, refs, conditional children — overview.md
.style()model: properties, units, safe areas, responsive, animateTo — styling.mdUIRow,UIColumn,UIBox(deprecated),UIScrollable,UISpacer— containers.mdUIText,UIImage,UIVideo— content.mdUIButton,UIInput,UITextArea— interactive.mdUIScreen,Router— screens & navigation — screen-router.mdUIWidget— floating overlays, modals, bottom sheets — widget.mdUIVirtualizedList— windowed lists for long data — virtualized-list.mdregisterFont— custom fonts — fonts.md
Plugins — plugins/
CameraViewer— device camera feed — camera-viewer.mdQRScanner— host-optional QR scanning — qrscanner.md
Coverage tooling
bun run docs:check (→ check.mjs) verifies that every global exported from
src/inject.ts (+ host globals) has exactly one canonical page, that sources: paths exist, and
that relative links resolve.