Ollin API
This is the reference for Ollin's drawing surface and helpers. The bare calls you write in draw() forward to an internal Drawer (see How it works). Everything on these pages is callable bare inside a Sketch.
The Ollin quick reference is the whole framework in one read: how a sketch runs, what the calls are called, the units they take, the command line, and the mistakes that fail with no error. If you are new to Swift, start with the Swift quick reference. It covers just enough of the language to be productive in draw(). If you come from p5.js or Processing, Appendix C of the Guide maps the API you already know onto Ollin. Appendix E does the same for openFrameworks and OPENRNDR.
The catalog
Everything below ships in this repository, listed by what it is for. Each row links to the reference page for its area, and the two largest areas are listed in full under the table. The groups after it list every page by area, with one line on each.
| Area | What's in it |
|---|---|
| Shapes & geometry | About thirty analytic shapes, from circles to stars to hearts, curved paths, concave and holed fills, variable-width strokes that taper and turn like a pen nib, marks whose width and opacity follow how fast and how hard you drew them, booleans and offsets, outlines you can ask questions of (the nearest point, the way a line runs there, where two lines cross, a lighter copy of a dense trace, rounded or cut corners), segments, arcs, and ellipses as values that know where they cross one another, spatial queries over a point set (which point is nearest, which points are within a distance, which points are inside a box), fitting a smooth field through values known at a few scattered points (and the warp that fit makes), or fitting a few parameters to a target, gradient paint and a shader as paint on every shape, blend modes, clipping, SVG import, noClear() accumulation for long-exposure looks plus an Accumulator whose running mean converges, depth of field from light (lines drawn as millions of scattered points through a lens), and retained batches for when static content gets heavy |
| Text & color | Bitmap, outline, and single-line plotter fonts through one drawText, text in any script (right-to-left, Devanagari, Thai, Japanese, emoji), set down the page in columns as well as across it, justified to a measure with its punctuation hung outside the margin, run along a path, moved along a variable font's own axes, or taken as vector Shapes that also extrude into 3D solids. For color: OKLab mixing, spectral color and paint mixing (pigments that mix to green, thin-film and diffraction filters), palette import and extraction, colormaps, gradients, color vision simulation so you can see a palette as a colorblind person does, describe so a sketch can tell a screen reader what it shows, wide-gamut and HDR output (Display P3 on screen, highlights brighter than white, HDR10 video, and stills that keep those highlights in a gain map), and images with pixel access, twenty bundled sample photographs to try things on, dithering, pixel sorting, seam carving, halftone screens, glyph mosaics, photo mosaics, and autostereograms |
| Shapes that merge | SDF combinators: smooth union, subtract, morph, machined joints, carpentry detailing, and domain mirror/tile/radial, reached through drawSDF, a scoped smoothUnion { } block, or the clay-like sculpt { } block. They work in 2D and in raymarched 3D, where the same fields can also twist, bend, and take surface displacement |
| Generative technique | Seventy-three techniques, listed in full below. They cover scatter and sampling, growth, rules and agents, grids and tilings and ornament, chaos and fractals, curves and figures, one-line renderings, fields and level sets, meshes and surfaces, and texture and terrain |
| Layered effects | Off-screen layers with more than fifty GPU filters, two-layer combines (mask, displace, seamless clone, depth of field, ambient occlusion, screen-space reflections), diffusion curves, feedback layers, and GPU simulation fields. One of the filters is post-process anti-aliasing, which smooths the stair-step edges of a layer that a shader wrote, because such a layer carries no coverage of its own. Another applies a look from a .cube file, the table a grading tool exports. Two more give a frame the texture of film, halation and grain. Six give a layer an edge of its own: an outline, a drop or inner shadow, an outer or inner glow, or a bevel. A caption or a readout drawn over the finished frame stays sharp whatever the frame's passes do under it. All of them can be declared as one compose { } block |
| Measured distance fields | Measure a distance field from any drawn layer: how far each pixel is from the nearest edge, and in which direction. Read it back as contour bands, as shapes grown or shrunk by a distance, as outlines at any offset, or as a Voronoi diagram built from the picture itself |
| Light in a flat sketch | Draw a scene in one layer and the lights in another, and Ollin computes the light that reaches every pixel. That gives you shadows that are sharp at the shape and soften with distance, falloff, beams through a gap, and color from a red wall spilling onto the floor beside it, without drawing any of it by hand |
| The frequency domain | Read a picture on the GPU as a sum of waves instead of a grid of pixels. Filtering by scale then becomes a shape drawn over the spectrum. If you keep the middle, the picture comes back soft. If you keep the outside, only its edges come back. A whole field can also be built from nothing but a description of its energy, which is how the ocean is made |
| Local averages | The average of the square around every pixel, at a cost that does not depend on the square's size, over a summed-area table. That gives a box blur whose cost does not grow with its radius, and an adaptive threshold that cuts a picture to two tones by comparing each pixel with its own surroundings, so a page lit from one side is still readable |
| Your own shaders | Write a shade(uv, info) fragment function inline or in a .metal file that hot-reloads. Compile errors are reported at your own line numbers, and a built-in helper library is spliced in. The same shader is paint: fill(shader) runs it per pixel inside any shape, in the shape's own coordinates. Or skip Metal and chain instead: Visual composes oscillators, noise, shapes, and layers through warps, blends, and modulations, and runs them in one GPU pass however deep the chain grows. If you already have a GLSL shader, ollin new --from-shader translates it to Metal and writes the project around it. A shader can pull in another file, and ollin check compiles one on the GPU from the command line and reports what it found The library's complex module gives a float2 the arithmetic of a complex number, mirrored on the CPU by Complex. |
| GPU compute | A million particles updated and drawn each frame without touching the CPU, a cooperative neighbor-search primitive that artificial life and SPH fluids are built on, and ping-pong texture simulations drawn as images |
| Simulation & physics | A stepped World with Verlet particles and springs for soft bodies, and with Box2D bodies and joints for rigid ones, 3D rigid bodies that stack, tumble, and swing inside the 3D scene (backed by Jolt, with compound bodies, heightfield-terrain and Scene colliders, motored and limited joints, contacts and sensors, walking characters, driveable vehicles, ragdolls built from a skinned figure, soft-body cloth and pressurized shapes, ropes where every segment carries an orientation, tensegrities that stand on their own cables, buoyancy and swell, ray/sweep/overlap queries, collision groups, and mouse grabbing), plus SPH fluids and soft bodies, steering crowds at GPU scale, crowds that make room for each other and never walk through a wall, a million particles moving along a strange attractor, populations that evolve toward a target or by your own choice, matter that organizes itself and rules that spread by contact, reaction-diffusion, Lenia, Game of Life, water-surface ripples, multi-scale Turing patterns, the Abelian sandpile, real-time fluid, a wet-paint watercolor wash with real pigments and optical glazing on the GPU, articulated and chaotic motion for IK chains, pendulums, and n-body gravity, and coupled oscillators that fall into step |
| 3D (opt-in) | Cameras and whole imported scenes, lines between points in space, solids drawn in ink along their edges, geometry drawn at scale (instanced meshes, GPU-culled worlds, half a million blades of grass, an ocean), physically based materials and the full map set, area lights and image-based lighting, ray-traced reflections, caustics, and global illumination, and effects on the frame itself: anti-aliasing over time, depth of field through the camera's lens, motion blur, lens flare, and atmosphere. A scene can also be written down as line work a plotter can follow rather than drawn as a picture. Listed in full below. A 2D sketch never pays any cost for it |
| Perception | Nineteen on-device trackers that run over the Mac's camera or any video: face, hand, and body pose in 2D and 3D, segmentation (automatic or from a click), contours, optical flow, OCR, saliency, typed phrases scored against the picture, depth from a video model that holds still between frames, and custom Core ML models. An iPhone adds LiDAR depth clouds, the reconstructed room as a labeled surface with its flat planes, the room's own light, ARKit body and face capture, hand skeletons and readable text placed in metric 3D, the pictures and objects it recognizes, how its own picture is moving as a flow field, device motion, and the phone itself held as a pointer you aim at your sketch. All of that arrives over USB, live or from recorded clips, as metric RGBD frames |
| Data as material | loadTable reads a CSV or TSV file, with typed reads by column name. loadJSON reads a document you walk through by name and index. SVG import brings in vector artwork. A live feed reads one address again and again in the background, so a sketch can draw what is true right now. A weather reads the sky over a place in plain units and puts the sun where the clock says. All of them let a file or the world drive a drawing instead of hard-coded numbers |
| Sound | FFT analysis with band and beat detection and the note being sung (its pitch, its name and cents, the twelve pitch classes), listening for words and for named sounds (speech as a live caption, a clap or a bark as a trigger), and a synthesizer that the sketch itself plays. The synthesizer has voice presets over a shaped and filtered oscillator, physical models of a plucked string, a struck shape, a bowed string, and a blown tube, sampled instruments, a room of your own as a convolution reverb, a wavetable that a note reads by position and moves through as it sounds, grains cut out of a sound and piled back up, so a moment can be held and dragged through while the note keeps going, an instrument patched together from parts instead of picked from a list, an effects chain on the way out, and a place in the 3D scene for a sound to come from. All of that sound is carried into an exported video with no recording step. Algorithmic composition works out what to play (Euclidean rhythms, scales and chords, arpeggios, Markov sequences, a step sequencer with swing and an arpeggiator over held notes), and sonification plays a table column or a terrain profile as notes. A piece travels in and out as a MIDI file, read into notes a sketch plays or draws and written back out, so a phrase a sketch worked out opens in a sequencer |
| Control surfaces | MIDI and OSC in and out, bindable to @Param properties; the parameters published as an OSCQuery namespace a control app browses and builds its own controls from; a tangible surface of touches, tagged pieces, and shapes read from a marker table or a touch wall; game controllers read in draw() (sticks, triggers, buttons, and motion and a touchpad where the hardware has them, with several players at once); a serial port for the classic microcontroller loop (sensor lines read in draw() or bound to parameters, lines written back to drive servos and LEDs, with reconnection built in); the same loop without the wire over Bluetooth Low Energy (a heart rate strap, a weather sensor, a board of your own, plus every device in range drawn by signal strength); a remote surface that serves the sketch's @Param properties to a phone on the same Wi-Fi as touch controls; tempo sync so a set runs on the DJ's clock, over MIDI clock or a network tempo session shared with every Link-enabled app in the room; and the message bus a building speaks, so a sketch reads the sensors in a house and drives the lamps and machines on the same bus |
| Plays in your rig | Syphon out and in, a system-wide virtual camera that any webcam app can read, screen and window capture that takes any app on the Mac as live material whether or not that app cooperates, DMX lighting driven from draw() over Art-Net or sACN (and a lighting console can drive the sketch back), LED strips and matrices lit from the canvas's own pixels, sampled on the GPU each frame, show lasers drawn from draw() as an optimized point stream sent to a network DAC or written to an ILDA file, video playback as live GPU textures, slit-scan time displacement over any frame history, haptics so a sketch can also play a designed pattern of taps and hums under the hand, and a room that several machines join by name alone, with no server, so they draw one work on one clock with one seat each |
Generative technique
Each one has its own reference page.
- Scatter & sampling: Voronoi and Delaunay (plus weighted power diagrams), breaking a shape or a solid into pieces, Poisson-disk scatter, low-discrepancy sampling, points scattered over a mesh surface, circle, shape, and rectangle packing, stippling
- Growth: L-systems (symbolic and parametric), shape grammars (ice-ray lattices, building fronts, nested figures), differential growth, space colonization, diffusion-limited aggregation, dielectric breakdown, crack growth, meander migration
- Rules & agents: Wave Function Collapse (from declared tiles or learned from an example picture), flow fields, boids and steering, pursuit curves, force-directed graph layout, random walks
- Grids, tilings & ornament: Truchet, hitomezashi stitching, mazes of diagonals, the Ulam spiral, Ford circles, de Bruijn sequences, kolam and sona, Celtic knotwork, crease patterns (the Miura fold and rotating-squares kirigami), polyominoes (the pentomino set and an exact-cover fit), hex and triangle grids, subdivision, mazes, the Apollonian gasket, aperiodic tilings (Penrose, Wang, girih star patterns, the spectre), hyperbolic tilings (any {p,q} in the Poincaré disk), parquet deformations (a tiling whose tile changes shape as you read across it)
- Chaos & fractals: strange attractors, billiards (a ball bouncing in a circle, ellipse, polygon, or stadium), chaotic maps and bifurcation diagrams, fractals (IFS, flames, inversion and Kleinian limit sets), cellular automata
- Curves & figures: classic curves (including spirolaterals), a turtle you drive, envelopes and caustics, clothoids (the Euler spiral, easements, and corners a vehicle could take), anamorphosis (a flat plate that only looks right reflected in a mirrored cylinder), Fourier epicycles, shape morphing
- One-line renderings: single-line TSP renderings, points sorted along a Hilbert curve, ant-colony tours, spanning-tree renderings, string-art windings
- Fields & level sets: percolation clusters, isolines (marching squares), isosurfaces and metaballs (marching cubes, or dual contouring for a field with corners to keep)
- Meshes & surfaces: cutting solids into each other (union, intersection, difference on a
Mesh), sweeps, lofts, and strips (a shape carried along a 3D path whose frames never twist, a surface lofted through several shapes placed along it, a ribbon between two lines, and an even pace along a curve), shadow art, subdivision surfaces (Catmull-Clark and Loop), mesh growth (differential growth and reaction-diffusion over a surface), surface reconstruction (a point cloud or scan back to a mesh, and particle skinning), concave hulls and alpha shapes, medial-axis skeletons, straight skeletons and mitered insets - Texture, terrain & chance: paper marbling, generative watercolor, Chladni figures, terrain and erosion, river networks and basins, and seedable randomness
The 3D layer
All of it is opt-in, and a 2D sketch never pays any cost for it.
- Cameras & scenes: orbit and cinematic cameras, a catalog of solid primitives, meshes from file (OBJ, glTF, USDZ), and whole scenes (glTF, USD) imported with their named nodes, authored cameras, lights, and keyframe animations that play on the sketch's clock (or, with
ollin new --from-scene, written out as the placement calls that draw them) - Drawn at scale: point clouds, instanced meshes and GPU-culled fields (one mesh drawn thousands of times in one call, with each copy placed on the GPU, even from a compute kernel; a retained
MeshFielddraws a whole world with one call and culls each copy against the camera), strand fields (grass grown inside the draw call itself: half a million bending blades with no geometry buffers, culled against the camera and graded by distance), and an ocean (a wave spectrum inverse-transformed into a moving sea, drawn as water with no geometry either, with its wave height set as a measurement in world units rather than as a dial) - Materials & maps: stylized and physically based materials, with an ink line around any of them (the cartoon's outline), including glass (transmission, refraction, absorption) and thin-film color (the interference colors of a soap bubble, set by a thickness in nanometers), and the full texture-map set, with projected decals (pictures stamped onto whatever surfaces a box touches) and detail maps (texture that stays sharp under a close look)
- Light: area lights (glowing panels, disks, and tubes), a light that follows the camera (a headlight, or a whole rig that holds its look under an orbit), light shaping with IES photometric profiles and projected cookies, image-based lighting from bundled HDRIs, a procedural sky with its own sun as a light (which can carry raymarched volumetric cloudscapes), or a live camera feed (the real room lights the scene, as in AR), and soft shadows
- Ray-traced looks: ray-traced reflections (spread by the surface's own roughness, so satin shows a blurred room rather than a blurred sky) and refractions, the scene showing through glass on any GPU (a second pass is drawn with the glass removed and read along each body's own refracted exit ray, so a solid ball works as a lens), caustics (photon-traced light focused through glass and off polished metal, with prism dispersion), and real-time global illumination (bounce light through a probe field that is retraced live) on ray-tracing GPUs
- The frame: temporal anti-aliasing (jittered accumulation that refines edges past what MSAA gives, on any GPU), depth of field through the camera's own lens (highlights opening into the iris's shape, a blurred foreground as a veil), cinematic motion blur (per-object and camera streaks with a photographic shutter dial, deterministic in exports), lens flare (the ghosts a real lens prescription throws from a bright source, plus the star on the source itself, both shaped by the iris blades and fading as something covers the source), and atmosphere: height fog, aerial perspective (far geometry fading into a blue haze tinted toward the sky's own sun), and volumetric light beams, and volumes (smoke, cloud, fire, or ink drawn from a box of density samples, lit and shadowed by the scene, with solids sitting inside)
Five more 3D pages round this out. Lines in 3D draws a line between points in space with the 2D stroke's look, a depth at every point, and a weight on screen or in the world, plus axes and a grid built from it. Hidden-line solids draws a mesh's faces with only its creases and silhouette in ink, ten thousand copies in one draw. The Hopf fibration draws a whole sphere of interlocking circles, and no two of them meet. Depth compositing lets drawing in 2D sit inside the depth buffer. Combining 3D features covers how the pieces fit together.
Concepts
Each concept page is one screen on an idea that the reference pages below assume. Read one when you want the reason behind an API rather than its signature.
The frame- what a drawing call does, and what happens betweendraw()and the pictureWhere a point is- the canvas coordinates and their units, and the other coordinate frames a sketch meetsLayers- what an off-screen layer is, what it costs, and when you need oneWhat survives a frame- what Ollin keeps between frames and what it drops: state, the canvas, layers, batches, saved valuesWhy a run repeats- the seed and the clock, and what makes a sketch draw the same picture twiceLight and color- why color mixes in linear light, and what the last pass of a frame doesValues and bare calls- the typed values underdrawCircle(x, y, r), and when to use them
Core
Sketch- the lifecycle (setup/draw), the clock values (time,frameCount, …), loop control withredraw(), andisExportingCanvas-scale, thecanvasSizeexport presets, and the preview window (windowMode)Variations-variation, the seed a run starts from. Step, roll, and jump through a sketch's variation space in the inspector. Proof a range as a contact sheet (--export-grid), and render the one you want to keep again with--seed.Replay- record a run's seed, clock, inputs, and parameter changes as a take (--record-take). Play it back exactly (--replay, with transport keys), scrub through it, and render the performance again through any export flag.Automation- keyframed parameters. A parameter's values are written down over time (automate) and joined by named or Bezier curves. The result loops, plays at any speed, reads from a file (--automation), and renders exactly in any export.
Drawing
Drawing-background,fill/stroke, the shapes, the transform stack, and the views over it (withClip,withViewBox,viewControl)Accumulation-noClearkeeps the canvas across frames, so drawing builds up (long exposures, paint on canvas).Accumulatoris a layer that keeps the running mean, so a picture built from faint samples converges.Depth of field from light-LineSprayandBokeh. Lines are drawn as millions of scattered points through a lens and added into a running mean until bokeh appears. The.lightparticle style and thedevelopprint filter are the parts underneath.HDR & tone mapping-toneMaprolls bright, out-of-range light off instead of clipping it. The page also covers the linear-float pipeline behind every frame, and the glow/bloom and sandpainting looks built on it.Wide gamut & HDR output-colorOutputto present through Display P3 and keep highlights brighter than white,Color(displayP3:)for colors outside sRGB, and HDR10 video exportRetained batches-makeBatchrecords heavy static drawing once, anddrawBatchreplays it each frame from the GPU at almost no cost. The transform in force at draw time places or stamps the whole recording.Layered effects-renderTarget/withTargetdraw into off-screen layers.filtered/postProcessrun GPU filters over them (blur, bloom, halation, film grain, color grade, gradient map, edges, halftone, …), and the result composites back with blend modes.combinedjoins two layers (mask, displace, mix, depth-of-field defocus).generatemakes procedural pattern sources,feedbackmakes trails and tunnels, andsimFieldruns the stateful sims (reaction-diffusion, Game of Life, fluid, the self-warp motion feedback, …).compose { }(withasidehelper layers) declares a stack of layers as one block.Looks-ColorLUTreads a.cubefile, the color table a grading tool exports, andFilter.lutapplies it to a layer or the whole frame, a cube by tetrahedral interpolation. A look can also be built in code and written out as a.cube.Marks-StrokeMark/drawMarkandStrokeDynamics. Width and opacity follow how a mark is being made, rather than where you are along the path. That means how fast the pointer moves and how hard it is pressed.Text-drawTextwith bitmap, outline (.ttf/.otf), and stroke (single-line / plotter) fonts, plustextToShapes(text as geometry) and text in any script (right-to-left, Devanagari, Thai, Japanese, emoji)Images-loadImage,drawImage,tint, and pixel access. Load or build a raster image, draw it scaled or transformed, and recolor it.Sample photographs-SamplePhoto, twenty bundled photographs with their credits, one import away, for trying an image technique or a filter on a real picture.Glyph mosaic-drawGlyphMosaicrebuilds an image as a grid of text glyphs. Each cell's character is chosen by its measured ink in the active font.Halftone-drawHalftonerebuilds an image as the classic print dot screen: area-exact dots on a rotated grid, drawn as real circles for the plotter path.Autostereogram-Image.autostereogramhides a depth map in a repeating pattern. When the eyes pair the repeats, a surface that was never drawn stands out of the page.Photo mosaic-Image.mosaic+averageColor+drawMosaicrebuild a picture out of many smaller pictures. Each cell takes the picture whose average color is nearest, measured in linear light.Pixel sorting-Image.pixelSortedreorders runs of an image's own pixels along rows or columns, with each run bounded by brightness (the classic glitch melt).Seam carving-Image.seamCarvedandSeamMapresize a picture by removing the paths through it that matter least, so what matters keeps its shape. Masks can hold something still or remove it.Color- theColortype, the OKLab family and mixing,CIELab, how far apart two colors look and an image's histogram,Ramps andPalettes (loaded from a file, extracted from an image, or shaded with a drifting hue), dithering an image down to a palette, and perceptualColormapsSpectral color-Spectrum, the reflectance curve behind a color. It covers.paintmixing (Kubelka-Munk, with pigments meeting in green), filtering light by multiplication,Color(wavelength:)and blackbody glow, and the spectral GPU effects (.thinFilm,.diffraction,.paintMix).Geometry- theVector2,Vector3(sharing oneVectorsurface),Rotation3D,Ray3,Rectangle,Circle,LineSegment,Arc,Ellipse,Grid,Shape/Contour,Path, andHobbySplinevalue types (including theGridlayout helper, curved outlines, the questions a contour answers about itself, where any two curves cross throughPlaneCurve, shape booleans, and offsetting)SVG import-loadSVG/drawSVGread vector artwork intoShapes andContours: paths with curves and arcs, the basic shapes, groups and transforms, fills and strokes. The result is ready for booleans, offsets, hatching, and re-export.Fourier epicycles-Epicycles+drawEpicyclesrebuild any closed outline as a chain of spinning circles. A term-count dial runs from a soft approximation to an exact trace.Envelopes & caustics-envelope+caustic. An envelope is the curve a family of lines is tangent to, and a caustic is the bright curve where reflected or bent light gathers.Classic curves- the classic closed-form curves as geometry builders:phyllotaxis,lissajous,rose,superellipse,supershape,hypotrochoid/epitrochoid(the spirograph gears),guilloche(the twisted, cam-shaped rings of a rose engine), the damped-pendulumHarmonograph,spirolateral(a walk of growing steps repeated until it returns to its start), Chaikinsmoothed(iterations:)corner cutting, andsmoothed(neighbors:), the moving average that keeps every pointAnamorphosis-Anamorphosis, a plate that reads correctly only in a mirrored cylinder standing on the page, seen from one viewing spot. It covers the wrap at true size, the map for points, contours, and shapes, the part of a cylinder an eye can see, and the search that reads a plate back.Clothoid- the curve whose bend grows at a steady rate (the Euler or Cornu spiral). It gives the easement that joins a straight run to a turn with no kink, and the single curve that fits two points and two headings. It also gives a smooth path through waypoints, and polyline corners a vehicle could drive.Shape morphing-ShapeMorphtweens oneShapeinto another, and every in-between is a real vector shape (contour pairing, corner-keeping correspondence, holes that grow in and out).ShapeisTweenable, so aTimelinecan sequence geometry.Voronoi & Delaunay- tessellate points into vector geometry: Voronoi cells (the "crystallization" look) and the dual Delaunay triangle mesh, with Lloyd relaxation and weighted power diagramsSpatial index-SpatialIndex, the structure that answers what is near a point without reading every point. It finds the nearest point, the k nearest, everything within a radius, and everything inside a box, over a uniform grid or a k-d tree.Fitting-RadialBasis, a smooth field of numbers, vectors, or colors fitted through values you know at a few scattered places (a field of vectors also works as a warp), with its exact slope.Fit.minimizewalks a few parameters downhill against a cost function you write.Truchet tiling- one tile per grid cell, turned to a random orientation, so identical parts join into flowing loops (.arcs) or a maze (.diagonals)Hitomezashi stitching- one bit per grid line sets the phase of its dashes, and the shifted lines weave into staircases, loops, and a two-tone clothTen print-tenPrint, one of two diagonals per cell chosen by a coin flip, joined into the long connected paths the picture is known forKolam and sona- one line launched between a field of dots and bounced off the edges until it closes. The result is gcd(rows, columns) loops, and walls can steer the line.Celtic knotwork- the same line given width and an alternating over-under rule, returned already broken where each cord passes under anotherCrease patterns- the flat sheet a folded or cut object comes from: the Miura fold with its rigid folding in three dimensions, rotating-squares kirigami, and Kawasaki's and Maekawa's laws, which say whether a sheet can fold flatTiling & layout- the other ways to divide a canvas:HexGrid/TriangleGrid(the hex and triangle tilings, with hex distance, neighbors, and exact picking),subdivide(recursive panels, binary or quadtree),Maze(three carving algorithms, walls as clean line work, solution and longest paths), andapollonianGasket(the packing of kissing circles, each touching its neighbors)Aperiodic tilings- the tilings that never repeat:penroseTiling(kites and darts, rhombs, with the matching-rule arcs),wangTiling(edge-matching squares as one connected quilt),girihPattern(Islamic star patterns over any polygons, plus the five girih tiles), andspectreTiling(the einstein tile, straight or strictly chiral curved)Parquet deformations-parquetDeformationdraws a tiling whose tile changes shape as you read across it. The geometry lives on the lattice's shared edges, so a square becomes an interlocking key with nothing coming apart on the way.Hyperbolic tiling- regular tilings of the hyperbolic plane in the Poincaré disk.hyperbolicTilingtakes any {p,q} with (p-2)(q-2) > 4 and returns typed tiles with depth and a two-coloring parity, and aviewpointpans across the endless tiling.Strange attractors- chaotic systems as points. Continuous 3D orbits (Lorenz, Rössler, Aizawa, …) are integrated with Runge-Kutta and orbited by the camera. Iterated 2D maps (Clifford, de Jong, Hénon, Gumowski-Mira, Ikeda, hopalong) accumulate into density fields, andAttractorFlowmoves a million GPU particles through one field at once.SDF combinators- compose signed-distance fields so shapes merge instead of stacking: smooth union/subtract/intersect and morph, round/onion, and domain mirror/tile. TheSDFvalue type +drawSDFand a scopedsmoothUnion { }block do this in 2D, andSDF3D+drawSDF3Ddo it in a raymarched 3D form.Measured distance fields- measure a distance field back out of a drawn layer withFilter.distanceField: how far every pixel is from the nearest edge, and in which direction.Filter.fieldMapreads it back as contours, grown and shrunk shapes, and outlines, or a shader reads it as a Voronoi keyed to the picture.Layer styles- a layer given an edge of its own, read from its alpha:.outlineinside, outside, or centered on the edge,.dropShadowand.innerShadow,.outerGlowand.innerGlowthat follow the measured distance, and a lit.bevel. Each is one filter, and they stack in the order they are chained.The frequency domain- a picture read as a sum of waves instead of a grid of pixels.Filter.fourierwrites the spectrum on the GPU and.inverseFourierreads it back. Filtering by scale is then a shape drawn over the spectrum, and a field can be built from nothing but a description of its energy.Light in a flat sketch-Combine.lightcomputes the light that reaches every pixel of a flat scene. Draw the scene in one layer and the lights in another. One measurement (radiance cascades) then gives you shadows that soften with distance, falloff, light through a gap, and the color a lit wall gives back.Local averages- the average of the neighborhood around every pixel at a fixed cost, over a summed-area table.Filter.boxBlurcosts the same at any radius, andFilter.adaptiveThresholdcuts a picture to two tones against each pixel's own surroundings, so uneven light no longer matters.
Shaders
These pages cover writing GPU code yourself. They describe fragment shaders that run through the effect graph, compute kernels over buffers and textures, and the helper library that both draw from.
Shaders- write your own fragment shader (Shader+ ashade(uv, info)function) and run it through the effect graph as a generator, filter, or combine, or as the paint a shape is filled or stroked with. A built-in shader library and line-accurate compile errors come with it.Visuals- compose animated imagery by chaining aVisual: sources (oscillator, noise, voronoi, shape) pass through warps, color moves, blends, and modulations. The whole chain compiles into a single GPU pass, and every number in it can animate at no extra cost.Shader library- reference for the helper functions a fragment shader or compute kernel can call: color/OKLab, hashes, value/gradient/curl noise, the 2D signed-distance catalog (smin,sdEllipse,sdHeart, …), and the repeat/mirror/polar domain operatorsCompute & GPU particles- GPU compute over buffers and textures.Particlesupdates and draws a million particles on the GPU each frame (the "sandpainting" engine), andSimulationruns reaction-diffusion, cellular automata, and other ping-pong texture sims. Both sit over theComputeKernel/ComputeBuffer/ComputeTexturecore, and the shared shader library is spliced into every kernel.
3D
3D- opt into a 3D camera and depth buffer. Orbit aCamera3D(perspective or orthographic) and drawPointClouds as instanced disc splats. There is a catalog of solid primitives (box, sphere, capsule, the Platonic solids, …), plus parametric and profile shapes (supershape, extrude, lathe). Meshes load from file (.obj,.usdz/.stl/.ply,.gltf/.glb). Two solids cut each other four ways (union,intersection,subtracting,symmetricDifference), so a bored, rounded or carved shape comes back as a mesh like any other. They can be textured and surface-mapped with normal, metallic-roughness, occlusion, emissive, and height maps. A height map gives parallax occlusion and real displacement. Triplanar projection covers meshes with no uvs, and detail maps add close-up texture. Projected decals stamp across every surface a box touches, and a live webcam depth cloud is included.Scenes-loadScenekeeps a glTF or USD file's structure instead of merging it. You get a tree of named nodes, drawn in place withdrawSceneand reached by name to animate (scene["lamp"]). The file's authored camera and punctual lights come out as readyCamera3D/Lightvalues, andapply(_:at:)plays the file's authored keyframe animations on the sketch clock.Instanced meshes- draw one mesh thousands of times in one call.drawMesh(_:instances:)takes a list ofMeshInstanceplacements (position, rotation, scale, tint) that the GPU applies per copy. It can also take aComputeBufferthat a kernel writes, so a simulation moves the copies without the CPU. Copies shade like solid meshes and cast into the shadow maps. A retainedMeshFieldscales this to a whole world drawn by one call, with each copy GPU-culled against the camera.The Hopf fibration- a sphere's worth of circles, where no two circles meet and every two are linked exactly once.hopfFibersreturns them as[Vector3]paths fordrawTube, andhopfBasessupplies the structured base sets (rings of latitude, or a spiral) that make the linking easy to see.Sweeps and strips-Mesh.sweepcarries aShapealong aCurve3D, a path through space whose frames turn with it and never twist about it, sizing and turning the shape on the way, andMesh.loftcarries several shapes placed along it and blends the surface from each to the next.Mesh.stripis the ribbon between two lines, andPacewalks a curve given as a function at one speed, or a strip at one rate of area.Lines in 3D-drawLineanddrawPolylineoverVector3draw a line between points in space through the camera, with the 2D stroke's weight, joins, caps, and soft edge, and a color per point if you like. Every point keeps its depth, so solids hide the line and the line hides what lies behind it.strokeWeight(_:in:)measures the weight on screen or in world units, anddrawAxes/drawGridare built from the same lines.Hidden-line solids-featureEdges(creaseAngle:)draws a mesh's faces in the fill and over them only its creases, its boundary, and its silhouette in the stroke, atstrokeWeightin canvas points. Near solids hide the edges of far ones, and copies drawn withdrawMesh(_:instances:)take their edges in one more GPU draw.noFeatureEdges()turns it off.Strand fields- grass that a mesh pipeline grows inside the draw call itself.StrandField+drawStrandsdraw half a million bending, swaying blades with no vertex or instance buffer anywhere. The blades are tile-culled by the camera, detail-graded by distance, and shaded and shadow-receiving on the solid lit path.The ocean- a sea built the way the ocean is measured.makeOceanFieldwrites a wave spectrum, and one inverse Fourier transform turns it into the moving surface.drawOceandraws it as water with no geometry anywhere, andwaveHeightis a measurement in world units rather than a dial.Combining 3D features- the practical map of what works with what: which geometry takes lights, materials, matcaps, and environment light; what casts, receives, and appears in shadows and reflections; when to use screen-space reflections and when ray-traced ones; and a step-by-step recipe for the most realistic sceneCamera control- move the camera by hand (cameraControl(): drag to orbit, scroll to dolly, right-drag or modifier-drag to pan, all damped) or play a ready-made cinematic move (cameraMove(_:): turntable, push-in, tilt, orbit-and-rise, reveal, handheld). Both are opt-in over the orbit pose.Caustics- the light that glass and metal focus.caustics()photon-traces the caster light through every transmissive and mirror-polished surface and draws where it lands. As a result, a glass sphere throws its bright spot into its own shadow, a chrome ring folds light beside itself, anddispersion:fans out a prism's rainbow. It needs a ray-tracing GPU.Lens flare- the light the camera itself adds to a picture.lensFlare()works out the ghosts a real lens prescription makes of each bright source. It places and sizes them, shapes them by the iris blades, colors them by the anti-reflective coating, and softens them by the size of the source. The star on the source itself has as many arms as those blades, frayed by the wear on them. Two lenses are bundled. All of it fades as something covers the source, rather than switching off.Line drawing- a 3D scene written down as 2D line work, with everything the surfaces hide taken out, so a pen plotter, a laser, or a vector file can have the scene the way only a picture could before.Atmosphere- the air between the camera and the scene.fogfades surfaces with distance and pools low with a height falloff (exact closed-form transmittance).aerialPerspectivesplits the fade by wavelength and lights it with the sun, so far ridges turn blue and fade into the sky.volumetricLightmarches the air, so spot cones, cookies, IES profiles, and cast shadows become visible beams and crepuscular shafts.Volumes- a cloud placed in the scene. AVolumeis a box of density samples, built from a function of position, from a list, or from noise filled across every core.drawVolumemarches it through the scene's depth with theMediumit is made of: how thickly it blocks light, the color it scatters the lights in, and its own glow. Solids sit inside it, the medium shades itself, and a solid's shadow falls through it.Depth compositing- place 2D drawing inside a 3D scene, so it occludes the geometry and is occluded by it:depth(at:),project, andwithBillboard(a 2D label hidden when it swings behind the cloud)Record3D-import OllinRecord3Dturns an iPhone's color-plus-depth into a 3D point cloud, from a recorded.r3dfile or a tethered phone's live USB streamRGBD- the oneRGBDFrame(color + depth + intrinsics) that any depth source produces. Unproject it to a point cloud, lift a single image point to metric 3D, or lift a 2D body pose into space (Body.lifted(through:)).Phone-import OllinPhonereads a tethered iPhone's live on-device ARKit sensor stream from Ollin's own capture app, over the USB cable. The stream carries a 3D body skeleton, a face mesh with expression blendshapes, and the hands in view as 21-joint skeletons lifted to metric 3D. It also carries the recognized text lines with their corners lifted to 3D, world-facing rear-LiDAR depth (a metric point cloud with the camera's 6DoF pose), the reconstructed room as a labeled surface, a person matte, how the picture is moving as a motion field, and device motion. A sketch on the Mac can also put itself on the phone's screen, sent down the cable as video, with the finger on the glass as its pointer.
Generators
Random-random,randomGaussian, and therandomVector/ringscatter helpersNoise- Perlinnoise/signedNoise, seamlessly loopingnoise(loop:), layeredfbm, andcurlNoiseflow fieldsBlue noise-poissonDisk, an even but organic scatter with no clumps or gaps (Poisson-disk sampling), over a rectangle or inside aShapeLow-discrepancy sampling-haltonPoints/sobolPoints, even coverage as an ordered stream: growing the count only adds points and never moves themPoints on a surface-surfacePoints, points scattered over a mesh's surface rather than its vertex list. They are evenly spaced by default, and each carries the normal, texture coordinate, and triangle it landed on.Stippling-stipple, dots packed to reproduce an image's tone (weighted-Voronoi stippling) or any density functionDe Bruijn sequences-deBruijnSequence+DeBruijnCode, a cyclic sequence that holds every window of a given length exactly once, so a glimpse of a few symbols tells you where it came fromFord circles-fordCircles, a circle for every fraction, each touching its neighbors and overlapping nothing, built overfareySequenceand the exactFractiontypeShadow art-shadowArt, a solid carved so that it throws the silhouettes you ask for, with the shadows it really casts so you can compare themPolyominoes-Polyomino+tilePolyominoes, the twelve pentominoes and an exact-cover search that fits a bag of pieces into a region, or reports that no fit existsUlam spiral-ulamSpiral, the whole numbers written in a square spiral, so a test on them becomes a picture. The primes fall on diagonals.Fractals-IFSchaos games,FractalFlamerenders, circle-inversion limit sets, and Kleinian limit-set curves, plus thefittedplacement helperChaotic maps & bifurcation-IteratedMap, the one-dimensional route to chaos: the logistic, sine, tent, and Gauss families, orbits and cobweb staircases, the bifurcation diagram as dots or a density image, and Lyapunov exponentsSingle line-singleLine, one continuous tour through an image's stipple (TSP art), returned as a plotter-friendlyContourHilbert order-hilbertOrder/hilbertSorted/hilbertIndex, points sorted by their place along a space-filling curve: one line through a stipple by a single sort, the local relative of the tourAnt colony-AntColony, a colony that lays pheromone trails and narrows a web of possible routes down to a short tour. The search itself is what you draw.Spanning tree-spanningTree, the minimum spanning tree of an image's stipple: the branching, vein-like relative of the single lineString art-StringArt, one continuous thread wound over rim pins until the crossings reproduce a picture (a stateful stepper)Percolation-Percolation, site-percolation clusters over a seeded grid: largest-first labeling, the spanning cluster, cell rectangles, and traced boundary loopsIsolines-isolines, level curves of any scalar field or of an image's tone, by marching squares: from metaball outlines to contour mapsIsosurfaces-isosurface/Metaballs, the surface where a field over space crosses a level, marched into aMesh(dual contouring where the field has corners to keep): soft spheres that fuse, noise volumes, gyroidsSubdivision surfaces-mesh.subdivided, a low-poly control cage refined into a smooth solid by the Catmull-Clark or Loop rules, with welding and open-edge handling built inMesh growth-MeshGrowth/MeshReactionDiffusion, a surface that grows more area than it has room for and folds: brain coral, branching coral, a ruffled leaf marginSurface reconstruction-reconstructSurface/particleSurface, from points back to aMesh. Rebuild a scanned room or object with its holes kept, or skin a particle set as one blended body.Fracture-fractured, breaking aShapeor aMeshinto pieces that fit back together with no gap and no overlap, evenly or crowded around a blow; plusconvexHullin space and the measurements a piece answersHulls-concaveHull/alphaShape, two tighter answers to "what shape are these points?": one simple polygon that follows the gulfs, or the scatter's true footprint with islands and holesMedial axis-medialAxis, a shape reduced to its skeleton, with every point carrying its inscribed-disk radiusStraight skeleton-straightSkeleton, the ridge network a shrinking boundary traces, with faces and exact mitered insets (inset(by:)). One build gives every topographic contour at once.Force-directed layout-ForceLayout, a graph that untangles itself: repulsion between all nodes, attraction along edges, and cooling into an even web you can grow, pin, and dragTensegrity-Tensegrity/addTensegrity, struts held apart by cables: the prism, the six-strut icosahedron, and a stacked mast, each in its balanced shape, withimbalanceto check a form of your own and aWorld3Dbuild that lands and standsMarbling-Marbling/drawMarbling, paper marbling in closed form: drops, tines, combs, and swirls rake vector ink outlines into feathered papersWatercolor shapes-Watercolor/drawWatercolor, watercolor pigment from recursively deformed polygons stacked as translucent layersChladni figures-chladni, a ringing plate's standing-wave field in closed form, plus the.chladnigenerator's sand and wave readings and the mode-by-pitch join to audioBilliards-Billiard, a ball that bounces forever in a circle, an ellipse, a polygon, or a stadium, with posts standing in it. The path comes back as geometry, and the shape of the room decides whether it draws a pattern or fills the floor.Drainage-Drainage, rivers computed from aHeightfieldrather than drawn. Hollows are filled so water always has a way out, and you get flow per cell, the network above a threshold as strokable reaches, Strahler ordering, and basins.Terrain-Heightfield, landscapes from noise ordiamondSquare, weathered by droplet hydraulic and thermal erosion, and emitted as terrain meshes, heightmaps, and contoursRandom walks-randomWalk/levyFlight/selfAvoidingWalk, paths built one random step at a time: the local tangle, the cluster-and-leap, and the single stroke that never crosses itselfCircle packing-packCirclesandrelaxCircles, filling a region with non-overlapping circles that grow until they touchShape grammars-ShapeGrammar, a design written as rules over labeled shapes: the balanced cut behind the ice-ray lattices, splits for a building front, insets that become bars, and nested turned copiesTurtle-Turtle, a pen you drive from code: forward, back, left, right, pen up and down, and a remembered pose for branches, every run an ordinary contourL-systems-drawLSystemand a preset catalog: a rewriting grammar that a turtle walks into fractal curves and branching plants, symbolic or parametric (symbols carry numbers, for fractional lengths, delays, and tapering width)Differential growth-DifferentialGrowth, a line of nodes that grows and folds into an organic, brain-coral structure (a stateful stepper)Meander-Meander, a river centerline that migrates by curvature, cutting off oxbow lakes and recording scars (a stateful stepper)Wave Function Collapse-wfcfills a grid so every neighbor is legal, from a tileset you declare or from the patches of an example picture (constraint-solved tile layouts, texture synthesis)Cellular automata-elementaryCA/totalisticCArow stacks chosen by rule number, andTurmitewalkers (Langton's ant and its relatives) painting a wrapped gridShape packing-packShapesandContinuousPacking, filling a region with non-overlapping shapes grown against each other's outlinesRectangle packing-packRectanglesandRectanglePacking, fitting rectangles of given sizes into one bin at their own sizes for a contact sheet, a collage, or an atlasFlow fields-FlowField, streamlines traced through a direction field (the flow-field look) and particles advected along itFlocking-Boids, a flock that steers by separation, alignment, and cohesion into emergent flocking motionPursuit-Pursuit, runners that head straight at each other and leave logarithmic spirals: the ring of mice, and a quarry that runs straight (a stateful stepper)Steering-Vehicle, a creature moved by composable steering forces (seek, flee, arrive, pursue, wander, follow a path or flow field)Space colonization-SpaceColonization, branching growth (veins, roots, trees) toward scattered attraction points (a stateful stepper)Diffusion-limited aggregation-DiffusionLimitedAggregation, branching clusters frozen out of random walkers (frost and coral; a stateful stepper)Dielectric breakdown-DielectricBreakdown, lightning grown where the solved electric field is strongest. Theetaexponent sweeps the result from a furry bush to a sparse Lichtenberg arc.Crack growth-CrackGrowth, perpendicular cracks that subdivide the plane into city-block cells, each dragging a one-sided watercolor wash (a stateful stepper)
Helpers
Math-map,dist,lerp, the shaping scalars (clamp/fract/step/smoothstep),polarandspherical,derivativeandgradient, andDouble.tauComplex-Complex, a point of the plane that multiplies: literals andNumeric, the polar form,exp/log/pow/sqrtand the trigonometric functions on the principal branch, theVector2bridge,ComplexPlane(the framing every picture of the plane shares, converting between its numbers and canvas points; a generator'splane), and the shader library'scomplexmodule as its twin on the GPUAnimation- looping progress (loopProgress/pingPong), the timers (every/after/everyFrames),sway(a value that travels between two ends and back, over five shapes), theEasingcurves,@Eased(ease toward a target),@Smoothed(smooth a noisy signal),@Sprung(spring toward a target with momentum), and theTimelinekeyframe sequencerFormula- a number written as a rule and read from text:drive($radius, "190 + sin(time) * 80"). The page covers the arithmetic a formula understands, the clock, canvas, pointer, and other parameters it can name, and the errors it reports rather than throws.Parameters-@Paramtunable parameters: typed inspector controls (from sliders and toggles to menus, color wells, text, and geometry fields) in grouped cards (with.foldedsections that start closed), value scrubbing, optional smoothing, and binding from OSC or MIDICues- looks you can call back:saveCuestores every parameter's value under a name,cue(_:over:)brings them back at once or over a fade, the inspector's Cues card lists and saves them, a MIDI program change or/ollin/cuecalls one in the performance host,Sketch.cues.jsonkeeps them beside the sketch, and--cuerenders an export at oneInput- mouse and keyboard, files dropped or picked through the open panel, and the pointer's shapeAccessibility- see your colors as the three kinds of color vision see them, check whether a palette's colors stay apart, and read the system's reduce-motion settingData-loadTablefor CSV and TSV files (typed reads by column name) andloadJSONfor documents you reach into by name and indexLiveData-DataFeed, one address read over and over on a background queue, so a sketch draws what is true now. It covers conditional polling, backoff, and one fixed answer in an export.Weather-Weather, the sky over a place or a name as plain readings (temperature, clouds, wind, rain, the condition in a word), andPlace.sun(at:)for where the sun is, with no networkAudio-import OllinAudiofor microphone, file, and oscillator sources, analyzed intoamplitude/spectrum/band values, beats, and the note heard (pitch,chroma) you read indraw()Listening- speech as a caption you can draw and phrases you can act on, plus about 300 everyday sounds named as they happen, over any audio sourceSynthesis-Synth, the instrument a sketch plays: notes by name or number,Voicepresets over a shaped and filtered oscillator, a wavetable read by position, a grain cloud cut out of a sound, delay and reverb, a room of your own as a convolution reverb, and a pitch shift and a freeze that take the sound apart into its partials firstComposition- working out what to play: Euclidean rhythms, scales and chords, arpeggios, and Markov sequences, as pure values of a step number, plus a step sequencer with swing, chance, and ratchets and an arpeggiator over held notes, both reading the beat you hand themMIDIFiles- a piece as a Standard MIDI File, read into notes a sketch plays or draws and written back out, with the tempo map that turns its beats into seconds, and a take recorded off a liveSynthSonification- numbers played as notes: a table column, a terrain profile, or a picture row, spread over a range of pitch and snapped to a scale
Simulation
Physics-import OllinPhysicsfor aWorldyou step each frame, so motion comes from simulation. It has a soft Verlet side (particles, springs, disk collisions) and a rigid side (bodies, colliders, joints, backed by Box2D).Physics3D- rigid bodies inside the 3D scene. AWorld3Dholds stacking, tumbling, swingingBody3Ds (backed by Jolt), with joints, contacts and sensors, walking characters, driveable vehicles, ragdolls built from a skinnedScene, cloth and ropes, mouse grabbing through the camera, andwithBodydrawing.Swarm- the steering behaviors at GPU scale: separation, alignment, cohesion, seek, flee, arrive, wander, and flow following, as weights over tens or hundreds of thousands of agentsArtificial life- three emergent-behavior systems on the GPU:ParticleLife, thePPSturning rule, andPhysarumslime mold. The first two run over a GPUSpatialHashneighbor search, which you can also build your own sims on.Evolution- populations that get better at something.Evolutionbreeds tens of thousands of GPU flights toward a target past obstacles by tournament selection, andPopulationbreeds a handful of genomes that a person picks by eye.Fluids & soft bodies- GPU particle dynamics:ParticleFluid(smoothed-particle hydrodynamics) andSoftBodies(shape-matched jelly blobs), both in a walled box you can splash and knead with the mouseWatercolor simulation- wet paint on rough paper: a three-layer wash simulation (watercolor(pigments:)) with real pigment behavior and Kubelka-Munk glazing. Paint with any drawing call, calldry()between washes, and callblot()for backrun blooms.Articulated & chaotic motion- CPU motion systems you step each frame:IKChain(inverse-kinematics tentacles and limbs),DoublePendulum(the classic chaos machine), andNBody(quadtree gravity for orbits, galaxies, and collisions)Crowds-Crowd, walkers that avoid each other by reciprocal velocity obstacles on the CPU: no overlap while every walker finds a safe velocity, obstacles and walls that hold even in a jam,isJammed, goals or apreferredVelocityruleCoupled oscillators-Kuramoto, a crowd of oscillators each pulled toward the phase of the others, on the CPU: the order parametercoherence, the critical coupling where a locked group forms, and local coupling on a ring, a square or hex lattice, or a graph of your own, withlocalCoherencefor where the crowd has locked
Integration
OSC-import OllinOSCto send and receive OSC messages over UDP (to and from TouchOSC, Max/MSP, TouchDesigner, …), read indraw()or bound to a@ParamOSCQuery-import OllinOSCto publish the sketch's@Paramparameters as a namespace a control app finds on the network and builds its own controls from, the values coming back over OSC at the same port numberTUIO-import OllinOSCto read a tangible surface: touches, tagged pieces, and shapes from a marker table, a touch wall, or a phone app, each keeping its id while it stays on the surfaceMIDI-import OllinMIDIto read from and send to MIDI controllers and keyboards over Core MIDI, read indraw()or bound to a@ParamLink-import OllinLinkto join the local network's shared tempo-and-phase session (the Link protocol most music apps support). A sketch then moves on the same beat and lands on the same downbeat as the whole rig, with no cabling or setup.Serial-import OllinSerialto read a USB microcontroller's sensor lines indraw()(or bound to a@Param) and write lines back to drive servos and LEDs. It covers IOKit discovery, automatic reconnection, and the classic physical-computing loop.Bluetooth-import OllinBluetoothto read a Bluetooth Low Energy sensor indraw()(or bound to a@Param) and write back to it. It covers the devices in range, a connection that waits and returns by itself, the standard's own values already named, and the permission the first run has to get past.MQTT-import OllinMQTTto join the message bus a building speaks. A sketch subscribes to the topics a house publishes on and reads them indraw()(or bound to a@Param), and publishes back to drive the lamps and machines. It covers topics and their wildcards, what the devices actually write in a payload, the two service levels, retained values, the last will, and a connection that comes back on its own.Remote-import OllinRemoteto serve the sketch's@Paramparameters to a phone or a second machine on the local network: a touch surface in any browser, live in both directions, for tuning an installation from in front of itRoom-import OllinRoomto let several machines on one network draw one work. They find each other by the room's name, with no server, and trade values and@Paramparameters. They agree on one clock so motion stays in step, and each takes a seat when the work is split across screens.DMX-import OllinDMXto drive stage lights and dimmers fromdraw()over Art-Net or sACN (aDMXUniverseof 512 channels, with a named-fixture shorthand). It also sends the canvas's own pixels to LED strips and matrices (LEDMap, sampled on the GPU each frame). A lighting console can drive a sketch too, with channels read indraw()or bound to a@Param.Laser-import OllinLaserto draw with a show laser fromdraw(). Line work is optimized into the point stream a projector scans (spacing, corner and blanking dwell, path order, the point budget). An arm gate and a stopped-beam rule guard the output, which is streamed to a network DAC or written as an ILDA file.Syphon-import OllinSyphonto share live visuals with other Mac apps (openFrameworks, Resolume, MadMapper, VDMX, …): publish a sketch's frames as a Syphon source, and draw an incoming Syphon feed as anImageVirtual camera-import OllinCamerato feed a sketch's frames to the Ollin Camera system camera, so webcam apps and browser tools (Zoom, OBS, Hydra viagetUserMedia, …) read the sketch as a live cameraGame controllers-import OllinControllerto read a game controller indraw(): sticks, triggers, and buttons on any pad, plus motion and a touchpad on hardware that has them, with several players at onceHaptics-import OllinHapticsto add touch feedback beside the picture. A pattern of taps and hums is composed like a phrase and played fromdraw(). It is translated for the trackpad's three feelings and one strength, and played as written where a full haptic engine exists.Screen capture-import OllinScreento take any display, app, or window on the Mac as a live GPU-textured frame source, drawn and filtered like any image and read by the vision trackers. It is the counterpart to Syphon for apps that do not publish their frames. It also includes the feedback tunnel you get when a sketch captures the screen it is drawn on.
Vision
Vision-import OllinVisionfor the Mac's camera (built-in, Continuity, or external) plus Apple's on-device perception, returned as typed results you read indraw(). Nineteen trackers cover detection (rectangles, barcodes/QR, text/OCR, contours into vectorShapes), tracking (a patch you point at, parabolic trajectories, dense optical flow), and segmentation (person, subject, and point-prompted mattes and cutouts). They also cover pose (face landmarks, hand and body skeletons, the 3D body in meters), classification, saliency, typed phrases scored against the picture, and depth that holds still from a video model, plus any custom Core ML model.
Video
Video-import OllinVideoto play a video file into a sketch as a live image. Each decoded frame arrives as a GPU texture you draw withdrawImage, and a CPUsnapshot()gives you pixel reads and analysis.Slit scan-SlitScan, a rolling frame history read back through a per-pixel time delay: the classic scan, time ripples, displacement maps
Output
Export- save frames as raster (PNG, sequences), motion (video, animated GIF), vector (SVG for pen plotters, PDF for print), or linear EXR with depth, for a compositorWeb page---export-webrecords what a sketch draws and writes a page that plays it back in a browser, as one self-contained file or as a fragment for a page of your ownPath-traced export---path-tracedrenders the same 3D scene offline by tracing light paths, for soft shadows, color bleed, mirror-in-mirror reflections, and a real lensRecording- record a live run as it happens, with the picture and the sketch's own sound (or the room's sound) in one movie, in real time, or copy one frame to the clipboardFabrication- write aMeshas STL, OBJ, or 3MF for 3D printing, with real units and a printability checkG-code- write a frame's line work as a program that a pen plotter, laser cutter, or CNC router runs directlyDXF- write a frame as a DXF drawing a CAD program or a laser cutter's software opens: lines, polylines, and true circles in millimeters, each color on its own layerEmbroidery- write a frame as the stitches an embroidery machine sews, a.dstfile with strokes as running stitch, fills as rows, and each color as its own threadInstallation- leave a sketch running for days: full screen, no pointer, a clock that survives a week, a watch that restarts it, and the building's hoursA sketch as an app- wrap a finished sketch as a signed, double-clickable Mac app that runs without the toolchain, with a frame of itself as its iconScreen saver- wrap a sketch as the machine's screen saver: one command writes the project, one script installs it, and the sketch stays an ordinary sketchWallpaper- run a sketch as the desktop wallpaper: one window per display at desktop level, behind the icons, with a menu-bar item to quit itMenu bar- run a sketch as a small live strip among the menu bar's status items, drawn at a rate an all-day surface can affordWidget- show a sketch as a widget on the desktop, drawn one picture per moment, so the sketch changes through the day rather than movingPrint separations- split a sketch into per-ink grayscale masters for risograph and screen printing, with an overprint preview and registration marksPrint color- soft-proof a canvas against a press profile, flag the colors ink cannot reach, and split it into process-color plates with their total-ink figuresSpatial- write a 3D frame or aSceneas USDZ, so the work opens in Quick Look, sends in a message, and stands on a real table through AR. Write the motion as spatial video, a stereo pair per frame, for a headset.
Tools
Project generator-ollin newandollin generate: a ready-to-run sketch folder from a few questions, with templates you can watch running before you pick oneSingle-file sketches- theollincommand: run one.swiftfile as a sketch from anywhere, no package needed, or a package's sketch with every file of it reloadingThe sketch on the phone-ollin phone: the sketch on a paired iPhone or iPad. It is installed again on every save, with its clock and parameters carried across, and the parameters stay live on the Mac. Or it stays on the Mac and shows on the phone's screen, with nothing installed.Live coding- the OllinLiveCoding performance host: write and evaluate sketch code live, with the code shown over the visualsBringing a shader over-ollin new --from-shader: translate a GLSL fragment shader into Metal and get a project around itChecking the machine-ollin doctor: what this machine can run, with the line that fixes each answer; shell completions, and--list-paramsfor what a sketch declaresChecking a shader-ollin check: compile a.metalfile on this machine's GPU and see the errors at your own line numbers, what kind of shader it is, and the parameters it readsBringing a scene over-ollin new --from-scene: a glTF or USD scene written out as the camera, lights and placement calls that draw itWriting an extension-ollin new --kind extension: a library other sketches import, theollinx-naming convention, and the seams to build onDragging a shape- Command-drag a shape in the live window, or on the performance stage, to move it, drag a corner to resize it, or drag the knob above it to turn it. The numbers in your own code change, with your spacing and comments untouched.The parameter timeline- OllinLive's timeline panel: a lane per automated parameter, keys placed from the inspector's diamonds and dragged by hand, a playhead over the sketch clock, and a round trip to the automation fileThe reference offline-ollin docs,ollin examples,ollin api, andollin site: these pages, every example sketch, and every public name, read in the terminal or written out as a website. They come from the checkout you build against, and a search covers the whole referenceProfiling- the inspector's cost row: CPU against GPU on one scale, the draw and pass counts, and a frame handed to Xcode
Coordinates use a top-left origin with y increasing downward, the same as p5, Processing, and OPENRNDR. The Where a point is page covers this in one screen, including the units.