Expression vocabulary
The expression vocabulary the engine accepts, as the engine reports it. Grammar and semantics: Parameters and expressions.
Namespaces
Static namespaces, PascalCase. Each function is called as Namespace.function(...).
Point
Point.distance(from: point, to: point) -> numberPoint.midpoint(from: point, to: point) -> pointPoint.interpolate(from: point, to: point, fraction: number) -> pointPoint.translate(point: point, offset: vector) -> point
Vector
Vector.length(vector: vector) -> numberVector.normalize(vector: vector) -> vectorVector.dot(a: vector, b: vector) -> numberVector.cross(a: vector, b: vector) -> vectorVector.angle(a: vector, b: vector) -> numberVector.add(a: vector, b: vector) -> vectorVector.subtract(a: vector, b: vector) -> vectorVector.scale(vector: vector, factor: number) -> vectorVector.fromTo(from: point, to: point) -> vector
Plane
Plane.fromPointNormal(point: point, normal: vector) -> planePlane.point(plane: plane) -> pointPlane.normal(plane: plane) -> vectorPlane.distance(plane: plane, queryPoint: point) -> number
Line
Line.fromPointDirection(origin: point, direction: vector) -> lineLine.fromTwoPoints(fromPoint: point, toPoint: point) -> lineLine.origin(line: line) -> pointLine.direction(line: line) -> vectorLine.pointAt(line: line, distance: number) -> point
Transformation
Transformation.translation(vector: vector) -> transformTransformation.rotation(axis: line, angle: number) -> transformTransformation.scaling(sx: number, sy: number, sz: number) -> transformTransformation.compose(a: transform, b: transform) -> transformTransformation.invert(matrix: transform) -> transformTransformation.apply(matrix: transform, point: point) -> pointTransformation.applyVector(matrix: transform, vector: vector) -> vector
Color
Color.mix(from: color, to: color, fraction?: number) -> colorColor.darken(color: color, step?: number) -> colorColor.lighten(color: color, step?: number) -> colorColor.saturate(color: color, step?: number) -> colorColor.rotate(color: color, degrees?: number) -> colorColor.hsl(hue: number, saturation?: number, lightness?: number) -> colorColor.rgb(red: number, green: number, blue: number) -> colorColor.alpha(color: color, value: number) -> colorColor.contrast(background: color, dark?: color, light?: color) -> colorColor.luminance(color: color) -> number
Format
Format.currency(value: number, code?: string, locale?: string) -> stringFormat.number(value: number, decimals?: number, locale?: string) -> stringFormat.percent(value: number, decimals?: number, locale?: string) -> stringFormat.date(value: number | string, locale?: string, style?: string) -> string
Arc
Arc.fromCenter(center: point, normal: vector, radius: number, startAngle: number, endAngle: number) -> curveArc.threePoints(startPoint: point, middlePoint: point, endPoint: point) -> curveArc.tangentEnd(startPoint: point, tangent: vector, endPoint: point) -> curve
Ellipse
Ellipse.fromCenter(center: point, normal: vector, radiusX: number, radiusY: number, xAxis: vector, startAngle: number, endAngle: number) -> curve
Bezier
Bezier.cubic(startPoint: point, control1Point: point, control2Point: point, endPoint: point) -> curveBezier.quadratic(startPoint: point, controlPoint: point, endPoint: point) -> curve
Nurbs
Nurbs.curve(points: point[], degree: number, knots: number[], weights: number[]) -> curve
Spline
Spline.through(points: point[], degree?: number, closed?: boolean) -> curve
Property
Property.parent(name: string) -> numberProperty.animate(name: string, seconds: number, values: array) -> actionProperty.set(name: string, values: array) -> action
Builtins
Math
Math.abs(value: number) -> numberMath.sign(value: number) -> numberMath.floor(value: number) -> numberMath.ceil(value: number) -> numberMath.round(value: number) -> numberMath.trunc(value: number) -> numberMath.fround(value: number) -> numberMath.clz32(value: number) -> numberMath.imul(a: number, b: number) -> numberMath.sqrt(value: number) -> numberMath.cbrt(value: number) -> numberMath.exp(value: number) -> numberMath.expm1(value: number) -> numberMath.log(value: number) -> numberMath.log2(value: number) -> numberMath.log10(value: number) -> numberMath.log1p(value: number) -> numberMath.sin(value: number) -> numberMath.cos(value: number) -> numberMath.tan(value: number) -> numberMath.asin(value: number) -> numberMath.acos(value: number) -> numberMath.atan(value: number) -> numberMath.sinh(value: number) -> numberMath.cosh(value: number) -> numberMath.tanh(value: number) -> numberMath.asinh(value: number) -> numberMath.acosh(value: number) -> numberMath.atanh(value: number) -> numberMath.atan2(y: number, x: number) -> numberMath.pow(base: number, exponent: number) -> numberMath.min(values?: number) -> numberMath.max(values?: number) -> numberMath.hypot(values?: number) -> numberMath.random() -> number
Number
Number.isInteger(value: any) -> booleanNumber.isFinite(value: any) -> booleanNumber.isNaN(value: any) -> booleanNumber.parseFloat(text?: string) -> numberNumber.parseInt(text?: string, radix?: number) -> number
Object
Object.keys(object?: object) -> arrayObject.values(object?: object) -> arrayObject.entries(object?: object) -> array
Array
Array.from(source?: array, mapFn?: function) -> array
Global
Global.isNaN(value?: number) -> booleanGlobal.parseFloat(text?: string) -> numberGlobal.parseInt(text?: string, radix?: number) -> numberGlobal.Number(value?: number) -> numberGlobal.String(value?: string) -> stringGlobal.Boolean(value?: boolean) -> booleanGlobal.Array(values?: any) -> array
Constants
Math.PI= 3.141592653589793Math.E= 2.718281828459045Math.LN2= 0.6931471805599453Math.LN10= 2.302585092994046Math.LOG2E= 1.4426950408889634Math.LOG10E= 0.4342944819032518Math.SQRT2= 1.4142135623730951Math.SQRT1_2= 0.7071067811865476Number.MAX_SAFE_INTEGER= 9007199254740991Number.MIN_SAFE_INTEGER= -9007199254740991Number.MAX_VALUE= 1.7976931348623157e+308Number.MIN_VALUE= 2.2250738585072014e-308Number.EPSILON= 2.220446049250313e-16Number.POSITIVE_INFINITY= nullNumber.NEGATIVE_INFINITY= nullNumber.NaN= null
Array methods
.map(callback: function) -> array.filter(callback: function) -> array.reduce(callback: function, initialValue?: any) -> any.find(callback: function) -> any.findIndex(callback: function) -> number.some(callback: function) -> boolean.every(callback: function) -> boolean.includes(searchElement?: any) -> boolean.indexOf(searchElement?: any) -> number.slice(start?: number, end?: number) -> array.concat(values?: any) -> array.join(separator?: string) -> string.flat(depth?: number) -> array.at(index?: number) -> any.reverse() -> array
String methods
.charAt(index?: number) -> string.at(index?: number) -> any.indexOf(searchValue?: string) -> number.slice(start?: number, end?: number) -> string.split(separator?: string) -> array.includes(searchValue?: string) -> boolean.startsWith(searchValue?: string) -> boolean.endsWith(searchValue?: string) -> boolean.toUpperCase() -> string.toLowerCase() -> string.trim() -> string.trimStart() -> string.trimEnd() -> string.replace(pattern?: string, replacement?: string) -> string.replaceAll(pattern?: string, replacement?: string) -> string.repeat(count?: number) -> string.padStart(targetLength?: number, padString?: string) -> string.padEnd(targetLength?: number, padString?: string) -> string.concat(values?: any) -> string
Properties, keywords, operators and budgets
- Properties:
array.length-> number;string.length-> number - Keywords:
true,false,null,undefined - Binary operators, lowest to highest precedence:
||(2),&&(3),==(4),===(4),!=(4),!==(4),<(5),<=(5),>(5),>=(5),+(6),-(6),*(7),/(7),%(7),**(8, right-associative) - Unary operators:
+,-,!,~ - Fields of a component readable as
key.<field>:materials,layers,patterns,options - Shadings:
wireframe,shaded,realistic,xray - Budgets:
evalStepBudget= 100000,maxArrayLength= 1000000,maxCallDepth= 64,exprMaxAstDepth= 100,exprMaxLength= 8000