UNPKG

1.89 kBTypeScriptView Raw
1import { ColorRepresentation } from "../math/Color.js";
2import { LineSegments } from "../objects/LineSegments.js";
3
4/**
5 * An axis object to visualize the 3 axes in a simple way.
6 * @remarks
7 * The X axis is red
8 * The Y axis is green
9 * The Z axis is blue.
10 * @example
11 * ```typescript
12 * const {@link AxesHelper} = new THREE.AxesHelper(5);
13 * scene.add(axesHelper);
14 * ```
15 * @see Example: {@link https://threejs.org/examples/#webgl_buffergeometry_compression | WebGL / buffergeometry / compression}
16 * @see Example: {@link https://threejs.org/examples/#webgl_geometry_convex | WebGL / geometry / convex}
17 * @see Example: {@link https://threejs.org/examples/#webgl_loader_nrrd | WebGL / loader / nrrd}
18 * @see {@link https://threejs.org/docs/index.html#api/en/helpers/AxesHelper | Official Documentation}
19 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/helpers/AxesHelper.js | Source}
20 */
21export class AxesHelper extends LineSegments {
22 /**
23 * Create a new instance of {@link AxesHelper}
24 * @param size Size of the lines representing the axes. Default `1`
25 */
26 constructor(size?: number);
27
28 /**
29 * A Read-only _string_ to check if `this` object type.
30 * @remarks Sub-classes will update this value.
31 * @override
32 * @defaultValue `AxesHelper`
33 */
34 override readonly type: string | "AxesHelper";
35
36 /**
37 * Sets the axes colors to {@link Color | xAxisColor}, {@link Color | yAxisColor}, {@link Color | zAxisColor}.
38 * @param xAxisColor
39 * @param yAxisColor
40 * @param zAxisColor
41 */
42 setColors(xAxisColor: ColorRepresentation, yAxisColor: ColorRepresentation, zAxisColor: ColorRepresentation): this;
43
44 /**
45 * Frees the GPU-related resources allocated by this instance
46 * @remarks
47 * Call this method whenever this instance is no longer used in your app.
48 */
49 dispose(): void;
50}