Uzay

Axes

3D coordinate axes

What is Axes3D?

Axes3D renders coordinate axes to provide orientation and scale reference in your 3D scene. By default, it shows the standard X, Y, and Z axes extending from the origin.

Basic Usage

const axes = scene.create("axes3d", {
  x: [-10, 10],
  y: [-10, 10],
  z: [-10, 10],
});

This creates axes extending from -10 to 10 on each axis.

Axis Configuration

Each axis can be configured independently with three possible values:

  • true: Show the axis extending infinitely. Currently not supported (it just sets the range to some high value).
  • false: Hide this axis
  • [min, max]: Show the axis within a specific range
// Full axes with specific ranges
scene.create("axes3d", {
  x: [-5, 5],
  y: [0, 10],  // Only positive Y
  z: [-5, 5],
});

// Only X and Y axes (for 2D-style visualization)
scene.create("axes3d", {
  x: [-10, 10],
  y: [-10, 10],
  z: false,
});

// Infinite axes
scene.create("axes3d", {
  x: true,
  y: true,
  z: true,
});

Styling

Color

By default, axes are white. Set a custom color:

scene.create("axes3d", {
  x: [-10, 10],
  y: [-10, 10],
  z: [-10, 10],
  color: "#888",
});

Thickness

Control the line width:

scene.create("axes3d", {
  x: [-10, 10],
  y: [-10, 10],
  z: [-10, 10],
  thickness: 0.5, // Thin axes
});

Decorations

Arrows

By default, axes display arrow cones at their positive ends to indicate direction. You can toggle this:

scene.create("axes3d", {
  x: [-5, 5],
  y: [-5, 5],
  z: [-5, 5],
  arrows: false, // Hide arrow tips
});

Tick Marks

Enable tick marks to show unit intervals along each axis:

scene.create("axes3d", {
  x: [-5, 5],
  y: [-5, 5],
  z: [-5, 5],
  tickmarks: true,
});

Tick marks and arrows follow per-axis visibility. If an axis is disabled (set to false), its tick marks and arrow are also hidden.

Common Patterns

Standard 3D Axes

scene.create("axes3d", {
  x: [-10, 10],
  y: [0, 10],
  z: [0, 10],
  thickness: 0.5,
});

Positive Quadrant Only

For visualizations where only positive values matter:

scene.create("axes3d", {
  x: [0, 10],
  y: [0, 10],
  z: [0, 10],
});

2D Mode (XY Plane)

For planar visualizations:

scene.create("axes3d", {
  x: [-10, 10],
  y: [-10, 10],
  z: false,
});

Examples

Axis ranges can be reactive:

const scale = scene.atom(5);

const axes = scene.create("axes3d", {
  x: scene.atom((get) => [-get(scale), get(scale)]),
  y: scene.atom((get) => [-get(scale), get(scale)]),
  z: scene.atom((get) => [-get(scale), get(scale)]),
});

// Axes expand/contract as scale changes
scale.set(10);

API Reference

Options

PropertyTypeDefaultDescription
xboolean | [number, number]trueX-axis configuration
yboolean | [number, number]trueY-axis configuration
zboolean | [number, number]trueZ-axis configuration
colorstring"white"Axis color
thicknessnumber1Line width
visiblebooleantrueWhether the axes are shown
arrowsbooleantrueShow arrow cones at positive ends
tickmarksbooleanfalseShow tick marks at unit intervals
pointerEvents"auto" | "none""auto"Whether the axes receive pointer events
tagsstring[][]Custom tags

Axis Configuration Values

ValueMeaning
trueShow axis (infinite extent)
falseHide axis
[min, max]Show axis from min to max

Returned Item

FieldTypeDescription
idstringUnique identifier
xBoundAtom<boolean | [number, number]>X-axis config atom
yBoundAtom<boolean | [number, number]>Y-axis config atom
zBoundAtom<boolean | [number, number]>Z-axis config atom
colorBoundAtom<string>Color atom
thicknessBoundAtom<number>Thickness atom
visibleBoundAtom<boolean>Visibility atom
arrowsBoundAtom<boolean>Arrows atom
tickmarksBoundAtom<boolean>Tick marks atom
pointerEventsBoundAtom<string>Pointer events atom
tagsBoundAtom<string[]>Tags atom

On this page