Skip to content

Explanation

Scene and nodes

A scene is a tree of nodes, a camera and the settings to draw them. It draws whatever state its nodes are in right now; a timeline changes that state over time.

import { Scene, box, ground } from 'cseen';
const s = new Scene({
view: 'iso', // the camera
size: [320, 200], // drawing size in viewBox units
title: 'A box', // the accessible name
});
s.add(ground(), box({ at: [0, 0, 0] }));

A shape, a device, a chart and a wave are all nodes. They take the same options, can be grouped, moved and animated the same way, and the renderer gives none of them special treatment.

OptionMeaning
atposition of the node’s origin, in its parent
rotrotation in degrees about x, y and z
scaleuniform scale
opacitytransparency of the whole node, 0 to 1
layerdraw order between groups of things, lower first
Position, rotation, scale
Position, rotation, scaleat, rot (degrees around x, y, z) and scale work on every object.

Drag to turn, scroll or pinch to zoom, double click to reset.

Put nodes in a group to move, turn and scale them together. A group is also a unit for depth sorting.

Groups
GroupsPut things in a group to move, turn or scale them together.

Drag to turn, scroll or pinch to zoom, double click to reset.

You never pass a colour. You pass a role, and CSS decides what it looks like: ink, faint, accent, warm, cool, s1 to s8, or any role you define. See Theming.

Colour roles
Colour rolesYou pass a role, and CSS decides what it looks like. Change the theme to see everything follow.coolwarmaccentfaintink

Drag to turn, scroll or pinch to zoom, double click to reset.

anchor() gives a point that stays attached to an object. An arrow drawn between two anchors follows both as they move.

import { Scene, box, line } from 'cseen';
const s = new Scene();
const a = s.add(box({ at: [-2, 0, 0], size: 1 }));
const b = s.add(box({ at: [2, 0, 0], size: 1, role: 'accent' }));
s.add(line(a.pt('center'), b.pt('center')));
Things that follow things
Things that follow thingsanchor() is a point that stays attached to an object, so an arrow between two anchors follows both.

Drag to turn, scroll or pinch to zoom, double click to reset.

Devices, waves and charts expose named anchors the same way (router.signal(), antenna.signal()), so you attach things to them without writing coordinates.

alpha makes a surface see-through; opacity fades a whole object.

See-through surfaces
See-through surfacesalpha makes a surface see-through; opacity fades a whole object.alpha 0.2alpha 0.5alpha 1

Drag to turn, scroll or pinch to zoom, double click to reset.