Repository navigation
Headless Evaluation
The document compiler/evaluator can run without mounting a browser or importing React:
import {
compileScene, evaluateDocument, SceneValidationError
} from 'webnim/document';
// scene is the SceneDocument from the quick start.
try {
const compiled = compileScene(scene);
const frame = evaluateDocument(compiled, 3, { along: 0.7 });
console.log(frame.time, frame.activeSpace, frame.parameters);
console.log(frame.diagnostics);
} catch (error) {
if (error instanceof SceneValidationError) {
for (const diagnostic of error.diagnostics) {
console.error(diagnostic.path, diagnostic.message);
}
} else {
throw error;
}
}Compile once and evaluate repeatedly. The optional third argument supplies parameter overrides. A frame contains spaces, evaluated objects, active-space/layer information, picture-in-picture data and diagnostics.
Validation combines structural schema checks with semantic checks for coordinates, expressions, references, dependency cycles and animation conflicts. Non-finite geometry at initialization can reject compilation; later invalid geometry is omitted with diagnostics so the application can recover through parameter changes or seeking.
evaluateCamera(spaceDefinition, frameSpace.camera, width, height) resolves authored camera steps for a viewport measured in CSS pixels, without browser rendering imports.
- Installation and development
- Browser quick start
- Scene documents
- Objects and expressions
- Document field reference
- Complete object reference
- Animation
- All animations and events
- Interaction and multiple views
- Browser player API
- Headless evaluation and validation
- Integration and lifecycle
- Features and limitations
- Publishing Webnim
- Troubleshooting
- Reference files