standard library
Documentation for the standard library.
Modules
function
linear
anim
Identity rate function: animation progress equals time progress.
function
smooth
anim
Default ease-in/ease-out rate for most animations.
function
smooth_in
anim
Rate that starts slowly and accelerates.
function
smooth_out
anim
Rate that starts quickly and settles slowly.
function
smoother
anim
Fifth-order smoothstep rate.
function
cosine
anim
Cosine ease-in/ease-out rate.
function
ease_in
anim
Power ease-in rate; larger p makes the start slower and the end sharper.
function
ease_out
anim
Power ease-out rate; larger p makes the start sharper and the end slower.
function
ease_in_out
anim
Symmetric power ease-in/ease-out rate.
function
exponential
anim
Exponential ease-out rate.
function
bounce
anim
Bounce-out rate with decaying rebounds near the end.
function
elastic
anim
Elastic-out rate that overshoots and rings into place.
constructor
Waitimportant
anim
Reserve time on the current slide without changing any followers.
constructor
Setimportant
anim
Snap selected followers to their current leader values.
constructor
PrimitiveAnim
anim
Low-level primitive animation wrapper used by higher-level animations.
constructor
Lerpimportant
anim
Interpolate selected followers toward their leaders using value interpolation.
constructor
Grow
anim
Reveal newly introduced mesh content by growing it outward from its center.
constructor
Fadeimportant
anim
Fade newly introduced content in and removed content out.
constructor
Writeimportant
anim
Draw stroke and text contours progressively.
constructor
Transimportant
anim
Morph between different mesh geometry by building a point/contour/surface matching plan.
constructor
TagTransimportant
anim
Morph meshes by matching tagged subparts before matching geometry.
constructor
Bend
anim
Morph line-based geometry by carrying local edge rotations through the path.
constructor
TagBend
anim
Bend morph that pairs tagged subparts before matching geometry.
constructor
CameraLerpimportant
anim
Interpolate a camera leader with camera-specific motion.
constructor
Highlight
anim
Temporarily change a mesh leader to a highlight color and then restore it.
constructor
Flash
anim
Sweep a moving write-window over a mesh and then restore it.
constructor
Transfer
anim
Move all mesh content from one leader into another and clear the source.
constructor
TransferSubset
anim
Move only the tagged subset matching a filter into another leader.
constructor
CopySubset
anim
Copy the tagged subset matching a filter into another leader.
constructor
Copy
anim
Copy all mesh content from one leader into another without clearing the source.
constructor
TransSubsetTo
anim
Move a tagged subset into an auxiliary target, morph it, then transfer it into another leader.
constructor
TransSubsetCopy
anim
Copy a tagged subset into an auxiliary target, morph it, then transfer it into another leader.
constructor
LaggedMap
anim
Run a list of animations with staggered offsets.
operator
slow
anim
Slow an animation by a multiplicative factor.
operator
fast
anim
Speed an animation up by a multiplicative factor.
operator
delay
anim
Delay an animation block by playing Wait before it.
operator
rateimportant
anim
Replace the rate function on a primitive animation.
constant
RED
color
Warm red RGBA color constant.
constant
ORANGE
color
Warm orange RGBA color constant.
constant
YELLOW
color
Bright yellow RGBA color constant.
constant
GREEN
color
Green RGBA color constant.
constant
TEAL
color
Teal RGBA color constant.
constant
CYAN
color
Cyan RGBA color constant.
constant
BLUE
color
Blue RGBA color constant.
constant
NAVY
color
Dark blue RGBA color constant.
constant
PURPLE
color
Purple RGBA color constant.
constant
MAGENTA
color
Magenta RGBA color constant.
constant
PINK
color
Pink RGBA color constant.
constant
BROWN
color
Brown RGBA color constant.
constant
WHITE
color
White RGBA color constant.
constant
LIGHT_GRAY
color
Light gray RGBA color constant.
constant
GRAY
color
Middle gray RGBA color constant.
constant
DARK_GRAY
color
Dark gray RGBA color constant.
constant
BLACK
color
Black RGBA color constant.
constant
CLEAR
color
Fully transparent black, useful for invisible fills and empty strokes.
function
rgb
color
Build an RGBA color from red, green, blue, and optional alpha components.
function
hsvimportant
color
Build an RGBA color from HSV components.
function
gray_shade
color
Build a gray RGBA color from one luminance value and optional alpha.
operator
alphaimportant
color
Return a color with the same RGB channels and a new alpha component.
constant
E
math
Euler's number.
constant
PI
math
Pi in radians.
constant
TAU
math
Full circle constant, equal to 2 * PI.
constant
ORIGIN
math
Origin point [0, 0, 0].
constant
ZERO_V
math
Zero vector [0, 0, 0].
constant
ONE_V
math
Vector with all components equal to 1.
constant
LEFT
math
Unit vector pointing left in scene coordinates.
constant
RIGHT
math
Unit vector pointing right in scene coordinates.
constant
UP
math
Unit vector pointing up in scene coordinates.
constant
DOWN
math
Unit vector pointing down in scene coordinates.
constant
FORWARD
math
Unit vector pointing forward; with the default camera this is negative z.
constant
BACKWARD
math
Unit vector pointing backward; with the default camera this is positive z, from the origin toward the camera.
constant
X_HAT
math
X-axis basis vector, equal to RIGHT.
constant
Y_HAT
math
Y-axis basis vector, equal to UP.
constant
Z_HAT
math
Z-axis basis vector, equal to BACKWARD.
function
sqrt
math
Square root.
function
cbrt
math
Cube root.
function
exp
math
Exponential function e^x.
function
ln
math
Natural logarithm.
function
log
math
Logarithm with optional base, defaulting to E.
function
log2
math
Base-2 logarithm.
function
log10
math
Base-10 logarithm.
function
sin
math
Sine of an angle in radians.
function
cos
math
Cosine of an angle in radians.
function
tan
math
Tangent of an angle in radians.
function
cot
math
Cotangent of an angle in radians.
function
sec
math
Secant of an angle in radians.
function
csc
math
Cosecant of an angle in radians.
function
arcsin
math
Inverse sine, returning radians.
function
arccos
math
Inverse cosine, returning radians.
function
arctan
math
Inverse tangent, returning radians.
function
arctan2
math
Two-argument inverse tangent, returning radians.
function
sinh
math
Hyperbolic sine.
function
cosh
math
Hyperbolic cosine.
function
tanh
math
Hyperbolic tangent.
function
abs
math
Absolute value.
function
sign
math
Sign of a number: -1, 0, or 1.
function
floor
math
Largest integer not greater than x.
function
ceil
math
Smallest integer not less than x.
function
round
math
Round to the nearest integer.
function
trunc
math
Truncate fractional part.
function
mod
math
Euclidean remainder of n divided by m.
function
min
math
Pairwise minimum of two numbers.
function
max
math
Pairwise maximum of two numbers.
function
clamp
math
Pin x to the inclusive range [low, high].
function
relu
math
Rectified linear unit, max(0, x).
function
sigmoid
math
Logistic sigmoid.
function
factorial
math
Factorial of a non-negative integer.
function
choose
math
Number of ways to choose r items from n.
function
permute
math
Number of ordered arrangements of r items from n.
function
gcd
math
Greatest common divisor.
function
lcm
math
Least common multiple.
function
is_prime
math
Test whether n is prime.
function
randomimportant
math
Deterministic scene random float in [low, high].
function
randintimportant
math
Deterministic scene random integer in [low, high).
function
mean
math
Mean of a numeric list.
function
variance
math
Variance of a numeric list.
function
std_dev
math
Standard deviation of a numeric list.
function
dot
math
Dot product of two vectors.
function
cross
math
Cross product of two 3-D vectors.
function
norm
math
Euclidean length of a vector.
function
normalize
math
Unit vector in the same direction as v.
function
proj
math
Projection of vector u onto vector v.
function
angle_between
math
Angle between two vectors, in radians.
function
lerpimportant
math
Interpolate between values according to Monocurl's value interpolation rules.
function
keyframe_lerpimportant
math
Piecewise interpolation through keyed values.
function
map_range
math
Remap x linearly from one interval into another.
function
deg_to_rad
math
Convert degrees to radians.
function
rad_to_deg
math
Convert radians to degrees.
constructor
Dot
mesh
A single point in 3-D space, rendered as a viewport-facing dot.
constructor
Circleimportant
mesh
A circle centered at the origin in the XY plane.
constructor
Annulus
mesh
A filled annulus between two concentric circles in the XY plane.
constructor
Squareimportant
mesh
A square centered at the origin with sides parallel to the axes.
constructor
Rectimportant
mesh
An axis-aligned rectangle centered at the origin.
constructor
RegularPolygon
mesh
A regular n-gon inscribed in a circle of the given circumradius, centered at the origin.
constructor
Polygon
mesh
A closed polygon from an ordered list of vertices.
constructor
Polyline
mesh
An open polyline through the given vertices.
constructor
Line
mesh
A straight line segment between two points.
constructor
Arrowimportant
mesh
A directed arrow from start to end, with an arrowhead at the tip.
constructor
Arc
mesh
Circular arc centered at the origin in the XY plane.
constructor
Capsule
mesh
Rounded filled capsule between two cap centers.
constructor
Triangle
mesh
Filled triangle from three vertices.
constructor
Sphere
mesh
3-D sphere centered at the origin.
constructor
RectangularPrism
mesh
Rectangular prism centered at the origin.
constructor
Cylinder
mesh
Cylinder oriented along a direction.
constructor
Cone
mesh
Cone from apex to base center.
constructor
Torus
mesh
Torus centered at the origin in the XY plane.
constructor
Plane
mesh
Rectangular plane in the XY plane, offset along `1b`.
constructor
Bezier
mesh
Bezier curve through control points, sampled as a 64-segment stroke.
constructor
Vector
mesh
Arrow-like vector from a tail by a delta.
constructor
HalfVector
mesh
Simple line segment from `tail` to `tail + delta`.
constructor
Image
mesh
Place a bundled or project image into the scene.
constructor
ColorGridimportant
mesh
Sample a color function over a rectangular grid.
constructor
LineGridimportant
mesh
Build a rectangular grid of line segments.
constructor
Fieldimportant
mesh
Sample a mesh-producing function over a rectangular field.
constructor
Textimportant
mesh
Plain text converted to mesh geometry.
constructor
Teximportant
mesh
Math text converted through TeX into mesh geometry.
constructor
Latex
mesh
Full LaTeX fragment converted into mesh geometry.
operator
text_tag
mesh
Attach tags to text fragments before they become mesh contours.
constructor
Brace
mesh
Brace drawn next to a target mesh.
constructor
Measureimportant
mesh
Measurement marker drawn next to a target mesh.
constructor
Label
mesh
Text label placed relative to a target mesh.
constructor
Number
mesh
Number rendered as text with optional formatting.
operator
axis_styleimportant
mesh
Pre-fill axis options on an axis constructor.
constructor
Axis1d
mesh
One-dimensional axis mesh along a basis vector.
constructor
Axis2dimportant
mesh
Two-dimensional coordinate axes, optionally with grid lines.
constructor
Axis3d
mesh
Three-dimensional coordinate axes, optionally with grid lines.
constructor
PolarAxis
mesh
Polar coordinate axis mesh.
constructor
ParametricFunc
mesh
Sample a 3-D parametric curve function.
constructor
ExplicitFuncimportant
mesh
Sample y = f(x) as a polyline in the XY plane.
constructor
ExplicitFunc2d
mesh
Sample z = f(x, y) as a 3-D surface.
constructor
ImplicitFunc2d
mesh
Sample an implicit 2-D contour f(x, y) = 0.
constructor
ExplicitFuncDiff
mesh
Fill the signed area between two explicit functions.
constructor
Stack
mesh
Lay meshes out in a line along a direction.
constructor
XStack
mesh
Stack meshes along the x axis.
constructor
YStack
mesh
Stack meshes along the y axis.
constructor
ZStack
mesh
Stack meshes along the z axis.
constructor
Grid
mesh
Return a nested mesh list unchanged for grid-style grouping.
constructor
Table
mesh
Return a nested mesh list unchanged for table-style grouping.
constructor
BoundingBox
mesh
Rectangle around the visible bounds of a mesh.
operator
shiftimportant
mesh
Translate a mesh by a vector.
operator
scale
mesh
Scale a mesh uniformly or per axis.
operator
rotate
mesh
Rotate a mesh around an axis and optional pivot.
operator
fade
mesh
Multiply mesh opacity by an opacity value.
operator
strokeimportant
mesh
Set stroke color and optional stroke width.
operator
fillimportant
mesh
Set fill color.
operator
dotted
mesh
Set dotted stroke color.
operator
colorimportant
mesh
Recolor both fill and stroke where applicable.
operator
normal_hint
mesh
Override the normal hint used for rendering or strokes.
operator
tagimportant
mesh
Replace mesh tags, optionally filtered by existing tags.
operator
textured
mesh
Apply an image texture to a mesh.
operator
z_index
mesh
Assign a draw ordering hint to a mesh.
operator
gloss
mesh
Add glossy lighting amount to a mesh.
operator
point_mapimportant
mesh
Map every point of a mesh through a function.
operator
color_map
mesh
Map mesh colors through a function.
operator
uv_map
mesh
Map mesh UV coordinates through a function.
operator
tag_map
mesh
Map mesh tags through a function.
operator
subset_map
mesh
Apply a mapping function only to tag-filtered subsets.
operator
uprank
mesh
Promote lower-dimensional topology into higher-dimensional topology.
operator
downrank
mesh
Demote higher-dimensional topology into lower-dimensional topology.
operator
wireframe
mesh
Convert surface-like geometry to wireframe display.
operator
dashed
mesh
Convert strokes to dashed strokes.
operator
subdivide
mesh
Subdivide mesh geometry for smoother downstream transforms.
operator
tesselated
mesh
Tessellate mesh geometry to the requested depth.
operator
extrude
mesh
Extrude a mesh by a delta vector.
operator
revolve
mesh
Revolve mesh geometry around an axis rotation.
operator
centerimportant
mesh
Move a mesh so its center lies at a point.
operator
camera_transfer
mesh
Keep a mesh fixed relative to the frame while camera changes.
operator
to_sideimportant
mesh
Move a mesh near one side of the camera frame.
operator
to_cornerimportant
mesh
Move a mesh near a corner of the camera frame.
operator
matched_edge
mesh
Place one edge of a mesh against an edge of a reference mesh.
operator
next_toimportant
mesh
Place a mesh next to a reference mesh.
operator
projected
mesh
Project a screen-space point along a ray into mesh space.
operator
in_space
mesh
Interpret a mesh inside a local coordinate space.
operator
tag_filterimportant
mesh
Keep only mesh leaves matching a tag filter.
function
tag_split
mesh
Split a mesh into [matching, non_matching] by tag filter.
function
mesh_collapse
mesh
Collapse nested mesh lists into a flatter mesh.
operator
contour_separate
mesh
Separate contours so morphing can treat them independently.
function
trans
mesh
Compute an intermediate Trans morph value between two meshes.
function
bend
mesh
Compute an intermediate Bend morph value between two meshes.
function
mesh_left
mesh
Left x bound of a mesh.
function
mesh_right
mesh
Right x bound of a mesh.
function
mesh_up
mesh
Up y bound of a mesh.
function
mesh_down
mesh
Down y bound of a mesh.
function
mesh_forward
mesh
Forward z bound of a mesh.
function
mesh_backward
mesh
Backward z bound of a mesh.
function
mesh_direc
mesh
Extreme bound of a mesh along a direction.
function
mesh_width
mesh
Width of a mesh bounding box.
function
mesh_height
mesh
Height of a mesh bounding box.
function
mesh_center
mesh
Center of a mesh bounding box.
function
mesh_rank
mesh
Topological rank of a mesh: 0 for dots, 1 for lines, 2 for surfaces.
function
mesh_tags
mesh
Tags present in a mesh.
function
mesh_sample
mesh
Sample a point on a mesh at normalized position t.
function
mesh_normal
mesh
Sample a normal on a mesh at normalized position t.
function
mesh_tangent
mesh
Sample a tangent on a mesh at normalized position t.
function
mesh_contains
mesh
Test whether a mesh contains a point.
function
mesh_dist
mesh
Distance from a point to a mesh.
function
mesh_raycast
mesh
Raycast against a mesh from a source along a direction.
function
mesh_vertex_set
mesh
Raw vertex set of a mesh.
function
mesh_edge_set
mesh
Raw edge set of a mesh.
function
mesh_triangle_set
mesh
Raw triangle set of a mesh.
function
mesh_contour_count
mesh
Number of contours in a mesh.
constructor
Camera
scene
Build a perspective camera from a position, target, up vector, and clipping range.
constant
DEFAULT_CAMERA
scene
Initial camera used by new scenes.
constant
DEFAULT_BACKGROUND
scene
Initial background color used by new scenes.
function
identity
util
Return the input unchanged, usually as a default mapper or sort key.
function
rangeimportant
util
Build a half-open numeric range, optimized by the compiler in simple `for` loops.
function
sampleimportant
util
Build uniformly spaced samples including both endpoints.
function
sample_clopenimportant
util
Build uniformly spaced samples including start but excluding stop.
function
const_listimportant
util
Build a list containing n copies of item.
function
lenimportant
util
Return the length of a list, map, or string.
function
reverse
util
Reverse a list or string.
function
sort
util
Stable sort with an optional key function.
function
map
util
Map a function over a list.
function
filter
util
Keep only elements for which predicate returns truthy.
function
reduce
util
Fold a list from left to right with an explicit seed.
function
zip
util
Pair corresponding elements from two lists, truncating to the shorter length.
function
enumerate
util
Pair every list element with its zero-based index.
function
all
util
Return truthy when every element is truthy.
function
any
util
Return truthy when any element is truthy.
function
count
util
Count elements satisfying a predicate.
function
sum
util
Sum a list; list values are added element-wise by the language.
function
product
util
Product of all elements in a list.
function
max_of
util
Maximum element of a non-empty list, optionally by key.
function
min_of
util
Minimum element of a non-empty list, optionally by key.
function
map_keys
util
Keys from a map in insertion order.
function
map_values
util
Values from a map in insertion order.
function
map_items
util
Key/value pairs from a map in insertion order.
function
take
util
First n elements of a list.
function
drop
util
List with the first n elements removed.
function
list_subset
util
Select list elements by index list.
function
flatten
util
Concatenate one level of nested lists.
function
depth
util
Maximum list nesting depth of a value.
function
str_len
util
Character length of a string.
function
str_replace
util
Replace all occurrences of needle with with.
function
str_split
util
Split a string by a separator.
function
str_upper
util
Uppercase a string.
function
str_lower
util
Lowercase a string.
function
str_join
util
Join strings with a separator.
function
to_string
util
Convert a value to a string.
function
to_int
util
Convert an integer, float, or numeric string to an integer.
function
to_float
util
Convert an integer, float, or numeric string to a float.
function
real
util
Real part of a number; non-complex numbers return themselves.
function
imag
util
Imaginary part of a number; non-complex numbers return 0.
function
type_of
util
Runtime type name for a value.
function
has_attr
util
Test whether a live function/operator value has a named argument attribute.
function
get_attr
util
Read a named argument attribute from a live function/operator value.
function
set_attr
util
Return a value with a named live-call argument changed.
function
get_defaults
util
Read callable default arguments.
operator
set_defaultimportant
util
Pre-fill one named default argument on a callable target.
operator
set_defaults
util
Pre-fill multiple named default arguments on a callable target.
function
runtime_error
util
Raise a runtime error with the given message.
function
is_nil
util
Test whether a value is nil.
function
is_int
util
Test whether a value is an integer.
function
is_float
util
Test whether a value is a float.
function
is_complex
util
Test whether a value is complex.
function
is_number
util
Test whether a value is numeric.
function
is_string
util
Test whether a value is a string.
function
is_list
util
Test whether a value is a list.
function
is_map
util
Test whether a value is a map.
function
is_mesh
util
Test whether a value is a mesh.
function
is_primitive_anim
util
Test whether a value is a primitive animation.
function
is_anim_block
util
Test whether a value is an animation block.
function
is_function
util
Test whether a value is a function.
function
is_operator
util
Test whether a value is an operator.
function
is_live_function
util
Test whether a value is a live function invocation.
function
is_live_operator
util
Test whether a value is a live operator invocation.
function
is_callable
util
Test whether a value can be called.
function
is_stateful
util
Test whether a value is stateful.