Something went wrong. Try again.
A three.js based web UI to create and export vases using code.
Something went wrong. Try again.
1.9 kB · 62 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263export interface ApiDoc { label: string signature: string description: string}
export const SHAPE_API: ApiDoc[] = [ { label: 'setParams', signature: 'setParams({ name: value, … })', description: 'Declares the shape’s parameters with default values. Each key becomes a slider in the Parameters panel. Call it once at the top of your script.', }, { label: 'params', signature: 'params.<name>', description: 'Reads the current value of a parameter — the slider value (or your default) is substituted in before the script runs.', }, { label: 'vec', signature: 'vec(x, y, z)', description: 'Creates a 3D point. Coordinates are in millimetres; Z is up.', }, { label: 'ring', signature: 'ring([ pts ])', description: 'Wraps an array of points (from vec) into a closed cross-section ring. Points should loop around the shape — the closing point is added automatically.', }, { label: 'loft', signature: 'loft([ rings ], { solid })', description: 'Skins an array of rings (bottom to top) into a mesh. Pass { solid: true } to close the top and bottom caps. Returns a shape.', }, { label: 'cylinder', signature: 'cylinder(r, h, { from, to })', description: 'Creates a solid cylinder of radius r and height h. Optional from/to points set its axis (defaults: from (0,0,0) to (0,0,h)).', }, { label: 'cut', signature: 'cut(a, b)', description: 'Subtracts shape b from shape a (a boolean difference).', }, { label: 'fuse', signature: 'fuse(a, b)', description: 'Joins shapes a and b into one (a boolean union).', }, { label: 'result', signature: 'result(shape)', description: 'Sets the final geometry. Call this once at the end of your script.', },]
export function apiDocFor(label: string): ApiDoc | null { return SHAPE_API.find((doc) => doc.label === label) ?? null}