isometric-diagrams
GitHubnpmCloud editor ↗

Isometric diagrams, from YAML

A generic engine for drawings of systems: regions, nodes, routes and steps, laid out for you, drawn in 3D isometric or as a flat 2D board, with a morph between the two. And the layers to build an editor for a format of your own.

npm i @johnoscott/isometric-engine

The format

Things placed next to each other, regions that grow to fit, routes that find their own path, labels that find a clear spot: a file rarely holds a coordinate.

3D and 2D

The same drawing as an isometric scene or a flat board of cards and panels, and an animated morph between them.

An editor of your own

A tree, a properties panel and a canvas over one undoable model: give the editor an adapter and a view for your format.

Layers

Core, objects, viewer and editor, each importing only those below it; three bundles, and every public module as a subpath.

Render a drawing

import { core, viewer, systems } from '@johnoscott/isometric-engine/systems';

const d = systems.compile(yamlText, themeText);   // diagnostics with lines and columns in d.diags
const style = document.createElement('style');
style.textContent = [core.themeCss(d.theme), systems.DRAWING_CSS, viewer.flatCss(), viewer.DUAL_VIEW_CSS].join('\n');
document.head.append(style);
const view = viewer.dualView(figure, d.scenes[0], { mode: '3d' });
viewer.viewToggle(document.body, [view]);        // the 3D | 2D switch