Ollin

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.

AreaWhat's in it
Shapes & geometryAbout 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 & colorBitmap, 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 mergeSDF 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 techniqueSeventy-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 effectsOff-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 fieldsMeasure 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 sketchDraw 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 domainRead 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 averagesThe 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 shadersWrite 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 computeA 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 & physicsA 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
PerceptionNineteen 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 materialloadTable 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
SoundFFT 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 surfacesMIDI 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 rigSyphon 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.

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 MeshField draws 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 between draw() and the picture
  • Where a point is - the canvas coordinates and their units, and the other coordinate frames a sketch meets
  • Layers - what an off-screen layer is, what it costs, and when you need one
  • What survives a frame - what Ollin keeps between frames and what it drops: state, the canvas, layers, batches, saved values
  • Why a run repeats - the seed and the clock, and what makes a sketch draw the same picture twice
  • Light and color - why color mixes in linear light, and what the last pass of a frame does
  • Values and bare calls - the typed values under drawCircle(x, y, r), and when to use them

Core

  • Sketch - the lifecycle (setup/draw), the clock values (time, frameCount, …), loop control with redraw(), and isExporting
  • Canvas - scale, the canvasSize export 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 - noClear keeps the canvas across frames, so drawing builds up (long exposures, paint on canvas). Accumulator is a layer that keeps the running mean, so a picture built from faint samples converges.
  • Depth of field from light - LineSpray and Bokeh. Lines are drawn as millions of scattered points through a lens and added into a running mean until bokeh appears. The .light particle style and the develop print filter are the parts underneath.
  • HDR & tone mapping - toneMap rolls 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 - colorOutput to present through Display P3 and keep highlights brighter than white, Color(displayP3:) for colors outside sRGB, and HDR10 video export
  • Retained batches - makeBatch records heavy static drawing once, and drawBatch replays 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/withTarget draw into off-screen layers. filtered/postProcess run GPU filters over them (blur, bloom, halation, film grain, color grade, gradient map, edges, halftone, …), and the result composites back with blend modes. combined joins two layers (mask, displace, mix, depth-of-field defocus). generate makes procedural pattern sources, feedback makes trails and tunnels, and simField runs the stateful sims (reaction-diffusion, Game of Life, fluid, the self-warp motion feedback, …). compose { } (with aside helper layers) declares a stack of layers as one block.
  • Looks - ColorLUT reads a .cube file, the color table a grading tool exports, and Filter.lut applies 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/drawMark and StrokeDynamics. 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 - drawText with bitmap, outline (.ttf/.otf), and stroke (single-line / plotter) fonts, plus textToShapes (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 - drawGlyphMosaic rebuilds an image as a grid of text glyphs. Each cell's character is chosen by its measured ink in the active font.
  • Halftone - drawHalftone rebuilds 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.autostereogram hides 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 + drawMosaic rebuild a picture out of many smaller pictures. Each cell takes the picture whose average color is nearest, measured in linear light.
  • Pixel sorting - Image.pixelSorted reorders runs of an image's own pixels along rows or columns, with each run bounded by brightness (the classic glitch melt).
  • Seam carving - Image.seamCarved and SeamMap resize 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 - the Color type, the OKLab family and mixing, CIELab, how far apart two colors look and an image's histogram, Ramps and Palettes (loaded from a file, extracted from an image, or shaded with a drifting hue), dithering an image down to a palette, and perceptual Colormaps
  • Spectral color - Spectrum, the reflectance curve behind a color. It covers .paint mixing (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 - the Vector2, Vector3 (sharing one Vector surface), Rotation3D, Ray3, Rectangle, Circle, LineSegment, Arc, Ellipse, Grid, Shape/Contour, Path, and HobbySpline value types (including the Grid layout helper, curved outlines, the questions a contour answers about itself, where any two curves cross through PlaneCurve, shape booleans, and offsetting)
  • SVG import - loadSVG/drawSVG read vector artwork into Shapes and Contours: 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 + drawEpicycles rebuild 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-pendulum Harmonograph, spirolateral (a walk of growing steps repeated until it returns to its start), Chaikin smoothed(iterations:) corner cutting, and smoothed(neighbors:), the moving average that keeps every point
  • Anamorphosis - 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 - ShapeMorph tweens one Shape into another, and every in-between is a real vector shape (contour pairing, corner-keeping correspondence, holes that grow in and out). Shape is Tweenable, so a Timeline can 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 diagrams
  • Spatial 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.minimize walks 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 cloth
  • Ten print - tenPrint, one of two diagonals per cell chosen by a coin flip, joined into the long connected paths the picture is known for
  • Kolam 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 another
  • Crease 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 flat
  • Tiling & 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), and apollonianGasket (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), and spectreTiling (the einstein tile, straight or strictly chiral curved)
  • Parquet deformations - parquetDeformation draws 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. hyperbolicTiling takes any {p,q} with (p-2)(q-2) > 4 and returns typed tiles with depth and a two-coloring parity, and a viewpoint pans 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, and AttractorFlow moves 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. The SDF value type + drawSDF and a scoped smoothUnion { } block do this in 2D, and SDF3D + drawSDF3D do it in a raymarched 3D form.
  • Measured distance fields - measure a distance field back out of a drawn layer with Filter.distanceField: how far every pixel is from the nearest edge, and in which direction. Filter.fieldMap reads 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: .outline inside, outside, or centered on the edge, .dropShadow and .innerShadow, .outerGlow and .innerGlow that 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.fourier writes the spectrum on the GPU and .inverseFourier reads 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.light computes 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.boxBlur costs the same at any radius, and Filter.adaptiveThreshold cuts 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 + a shade(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 a Visual: 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 operators
  • Compute & GPU particles - GPU compute over buffers and textures. Particles updates and draws a million particles on the GPU each frame (the "sandpainting" engine), and Simulation runs reaction-diffusion, cellular automata, and other ping-pong texture sims. Both sit over the ComputeKernel/ComputeBuffer/ComputeTexture core, and the shared shader library is spliced into every kernel.

3D

  • 3D - opt into a 3D camera and depth buffer. Orbit a Camera3D (perspective or orthographic) and draw PointClouds 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 - loadScene keeps a glTF or USD file's structure instead of merging it. You get a tree of named nodes, drawn in place with drawScene and reached by name to animate (scene["lamp"]). The file's authored camera and punctual lights come out as ready Camera3D/Light values, and apply(_: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 of MeshInstance placements (position, rotation, scale, tint) that the GPU applies per copy. It can also take a ComputeBuffer that a kernel writes, so a simulation moves the copies without the CPU. Copies shade like solid meshes and cast into the shadow maps. A retained MeshField scales 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. hopfFibers returns them as [Vector3] paths for drawTube, and hopfBases supplies the structured base sets (rings of latitude, or a spiral) that make the linking easy to see.
  • Sweeps and strips - Mesh.sweep carries a Shape along a Curve3D, a path through space whose frames turn with it and never twist about it, sizing and turning the shape on the way, and Mesh.loft carries several shapes placed along it and blends the surface from each to the next. Mesh.strip is the ribbon between two lines, and Pace walks a curve given as a function at one speed, or a strip at one rate of area.
  • Lines in 3D - drawLine and drawPolyline over Vector3 draw 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, and drawAxes/drawGrid are 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, at strokeWeight in canvas points. Near solids hide the edges of far ones, and copies drawn with drawMesh(_: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 + drawStrands draw 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. makeOceanField writes a wave spectrum, and one inverse Fourier transform turns it into the moving surface. drawOcean draws it as water with no geometry anywhere, and waveHeight is 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 scene
  • Camera 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, and dispersion: 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. fog fades surfaces with distance and pools low with a height falloff (exact closed-form transmittance). aerialPerspective splits the fade by wavelength and lights it with the sun, so far ridges turn blue and fade into the sky. volumetricLight marches the air, so spot cones, cookies, IES profiles, and cast shadows become visible beams and crepuscular shafts.
  • Volumes - a cloud placed in the scene. A Volume is a box of density samples, built from a function of position, from a list, or from noise filled across every core. drawVolume marches it through the scene's depth with the Medium it 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, and withBillboard (a 2D label hidden when it swings behind the cloud)
  • Record3D - import OllinRecord3D turns an iPhone's color-plus-depth into a 3D point cloud, from a recorded .r3d file or a tethered phone's live USB stream
  • RGBD - the one RGBDFrame (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 OllinPhone reads 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 the randomVector/ring scatter helpers
  • Noise - Perlin noise / signedNoise, seamlessly looping noise(loop:), layered fbm, and curlNoise flow fields
  • Blue noise - poissonDisk, an even but organic scatter with no clumps or gaps (Poisson-disk sampling), over a rectangle or inside a Shape
  • Low-discrepancy sampling - haltonPoints / sobolPoints, even coverage as an ordered stream: growing the count only adds points and never moves them
  • Points 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 function
  • De 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 from
  • Ford circles - fordCircles, a circle for every fraction, each touching its neighbors and overlapping nothing, built over fareySequence and the exact Fraction type
  • Shadow art - shadowArt, a solid carved so that it throws the silhouettes you ask for, with the shadows it really casts so you can compare them
  • Polyominoes - Polyomino + tilePolyominoes, the twelve pentominoes and an exact-cover search that fits a bag of pieces into a region, or reports that no fit exists
  • Ulam spiral - ulamSpiral, the whole numbers written in a square spiral, so a test on them becomes a picture. The primes fall on diagonals.
  • Fractals - IFS chaos games, FractalFlame renders, circle-inversion limit sets, and Kleinian limit-set curves, plus the fitted placement helper
  • Chaotic 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 exponents
  • Single line - singleLine, one continuous tour through an image's stipple (TSP art), returned as a plotter-friendly Contour
  • Hilbert 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 tour
  • Ant 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 line
  • String 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 loops
  • Isolines - isolines, level curves of any scalar field or of an image's tone, by marching squares: from metaball outlines to contour maps
  • Isosurfaces - isosurface / Metaballs, the surface where a field over space crosses a level, marched into a Mesh (dual contouring where the field has corners to keep): soft spheres that fuse, noise volumes, gyroids
  • Subdivision 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 in
  • Mesh growth - MeshGrowth / MeshReactionDiffusion, a surface that grows more area than it has room for and folds: brain coral, branching coral, a ruffled leaf margin
  • Surface reconstruction - reconstructSurface / particleSurface, from points back to a Mesh. Rebuild a scanned room or object with its holes kept, or skin a particle set as one blended body.
  • Fracture - fractured, breaking a Shape or a Mesh into pieces that fit back together with no gap and no overlap, evenly or crowded around a blow; plus convexHull in space and the measurements a piece answers
  • Hulls - 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 holes
  • Medial axis - medialAxis, a shape reduced to its skeleton, with every point carrying its inscribed-disk radius
  • Straight 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 drag
  • Tensegrity - Tensegrity / addTensegrity, struts held apart by cables: the prism, the six-strut icosahedron, and a stacked mast, each in its balanced shape, with imbalance to check a form of your own and a World3D build that lands and stands
  • Marbling - Marbling / drawMarbling, paper marbling in closed form: drops, tines, combs, and swirls rake vector ink outlines into feathered papers
  • Watercolor shapes - Watercolor / drawWatercolor, watercolor pigment from recursively deformed polygons stacked as translucent layers
  • Chladni figures - chladni, a ringing plate's standing-wave field in closed form, plus the .chladni generator's sand and wave readings and the mode-by-pitch join to audio
  • Billiards - 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 a Heightfield rather 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 or diamondSquare, weathered by droplet hydraulic and thermal erosion, and emitted as terrain meshes, heightmaps, and contours
  • Random 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 itself
  • Circle packing - packCircles and relaxCircles, filling a region with non-overlapping circles that grow until they touch
  • Shape 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 copies
  • Turtle - 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 contour
  • L-systems - drawLSystem and 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 - wfc fills 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/totalisticCA row stacks chosen by rule number, and Turmite walkers (Langton's ant and its relatives) painting a wrapped grid
  • Shape packing - packShapes and ContinuousPacking, filling a region with non-overlapping shapes grown against each other's outlines
  • Rectangle packing - packRectangles and RectanglePacking, fitting rectangles of given sizes into one bin at their own sizes for a contact sheet, a collage, or an atlas
  • Flow fields - FlowField, streamlines traced through a direction field (the flow-field look) and particles advected along it
  • Flocking - Boids, a flock that steers by separation, alignment, and cohesion into emergent flocking motion
  • Pursuit - 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. The eta exponent 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), polar and spherical, derivative and gradient, and Double.tau
  • Complex - Complex, a point of the plane that multiplies: literals and Numeric, the polar form, exp/log/pow/sqrt and the trigonometric functions on the principal branch, the Vector2 bridge, ComplexPlane (the framing every picture of the plane shares, converting between its numbers and canvas points; a generator's plane), and the shader library's complex module as its twin on the GPU
  • Animation - looping progress (loopProgress/pingPong), the timers (every/after/everyFrames), sway (a value that travels between two ends and back, over five shapes), the Easing curves, @Eased (ease toward a target), @Smoothed (smooth a noisy signal), @Sprung (spring toward a target with momentum), and the Timeline keyframe sequencer
  • Formula - 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 - @Param tunable parameters: typed inspector controls (from sliders and toggles to menus, color wells, text, and geometry fields) in grouped cards (with .folded sections that start closed), value scrubbing, optional smoothing, and binding from OSC or MIDI
  • Cues - looks you can call back: saveCue stores 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/cue calls one in the performance host, Sketch.cues.json keeps them beside the sketch, and --cue renders an export at one
  • Input - mouse and keyboard, files dropped or picked through the open panel, and the pointer's shape
  • Accessibility - 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 setting
  • Data - loadTable for CSV and TSV files (typed reads by column name) and loadJSON for documents you reach into by name and index
  • LiveData - 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), and Place.sun(at:) for where the sun is, with no network
  • Audio - import OllinAudio for microphone, file, and oscillator sources, analyzed into amplitude/spectrum/band values, beats, and the note heard (pitch, chroma) you read in draw()
  • 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 source
  • Synthesis - Synth, the instrument a sketch plays: notes by name or number, Voice presets 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 first
  • Composition - 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 them
  • MIDIFiles - 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 live Synth
  • Sonification - 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 OllinPhysics for a World you 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. A World3D holds stacking, tumbling, swinging Body3Ds (backed by Jolt), with joints, contacts and sensors, walking characters, driveable vehicles, ragdolls built from a skinned Scene, cloth and ropes, mouse grabbing through the camera, and withBody drawing.
  • 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 agents
  • Artificial life - three emergent-behavior systems on the GPU: ParticleLife, the PPS turning rule, and Physarum slime mold. The first two run over a GPU SpatialHash neighbor search, which you can also build your own sims on.
  • Evolution - populations that get better at something. Evolution breeds tens of thousands of GPU flights toward a target past obstacles by tournament selection, and Population breeds a handful of genomes that a person picks by eye.
  • Fluids & soft bodies - GPU particle dynamics: ParticleFluid (smoothed-particle hydrodynamics) and SoftBodies (shape-matched jelly blobs), both in a walled box you can splash and knead with the mouse
  • Watercolor 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, call dry() between washes, and call blot() for backrun blooms.
  • Articulated & chaotic motion - CPU motion systems you step each frame: IKChain (inverse-kinematics tentacles and limbs), DoublePendulum (the classic chaos machine), and NBody (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 a preferredVelocity rule
  • Coupled oscillators - Kuramoto, a crowd of oscillators each pulled toward the phase of the others, on the CPU: the order parameter coherence, 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, with localCoherence for where the crowd has locked

Integration

  • OSC - import OllinOSC to send and receive OSC messages over UDP (to and from TouchOSC, Max/MSP, TouchDesigner, …), read in draw() or bound to a @Param
  • OSCQuery - import OllinOSC to publish the sketch's @Param parameters 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 number
  • TUIO - import OllinOSC to 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 surface
  • MIDI - import OllinMIDI to read from and send to MIDI controllers and keyboards over Core MIDI, read in draw() or bound to a @Param
  • Link - import OllinLink to 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 OllinSerial to read a USB microcontroller's sensor lines in draw() (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 OllinBluetooth to read a Bluetooth Low Energy sensor in draw() (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 OllinMQTT to join the message bus a building speaks. A sketch subscribes to the topics a house publishes on and reads them in draw() (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 OllinRemote to serve the sketch's @Param parameters 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 it
  • Room - import OllinRoom to 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 @Param parameters. They agree on one clock so motion stays in step, and each takes a seat when the work is split across screens.
  • DMX - import OllinDMX to drive stage lights and dimmers from draw() over Art-Net or sACN (a DMXUniverse of 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 in draw() or bound to a @Param.
  • Laser - import OllinLaser to draw with a show laser from draw(). 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 OllinSyphon to 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 an Image
  • Virtual camera - import OllinCamera to feed a sketch's frames to the Ollin Camera system camera, so webcam apps and browser tools (Zoom, OBS, Hydra via getUserMedia, …) read the sketch as a live camera
  • Game controllers - import OllinController to read a game controller in draw(): sticks, triggers, and buttons on any pad, plus motion and a touchpad on hardware that has them, with several players at once
  • Haptics - import OllinHaptics to add touch feedback beside the picture. A pattern of taps and hums is composed like a phrase and played from draw(). 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 OllinScreen to 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 OllinVision for the Mac's camera (built-in, Continuity, or external) plus Apple's on-device perception, returned as typed results you read in draw(). Nineteen trackers cover detection (rectangles, barcodes/QR, text/OCR, contours into vector Shapes), 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 OllinVideo to play a video file into a sketch as a live image. Each decoded frame arrives as a GPU texture you draw with drawImage, and a CPU snapshot() 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 compositor
  • Web page - --export-web records 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 own
  • Path-traced export - --path-traced renders the same 3D scene offline by tracing light paths, for soft shadows, color bleed, mirror-in-mirror reflections, and a real lens
  • Recording - 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 clipboard
  • Fabrication - write a Mesh as STL, OBJ, or 3MF for 3D printing, with real units and a printability check
  • G-code - write a frame's line work as a program that a pen plotter, laser cutter, or CNC router runs directly
  • DXF - 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 layer
  • Embroidery - write a frame as the stitches an embroidery machine sews, a .dst file with strokes as running stitch, fills as rows, and each color as its own thread
  • Installation - 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 hours
  • A 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 icon
  • Screen 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 sketch
  • Wallpaper - run a sketch as the desktop wallpaper: one window per display at desktop level, behind the icons, with a menu-bar item to quit it
  • Menu 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 afford
  • Widget - show a sketch as a widget on the desktop, drawn one picture per moment, so the sketch changes through the day rather than moving
  • Print separations - split a sketch into per-ink grayscale masters for risograph and screen printing, with an overprint preview and registration marks
  • Print 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 figures
  • Spatial - write a 3D frame or a Scene as 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 new and ollin generate: a ready-to-run sketch folder from a few questions, with templates you can watch running before you pick one
  • Single-file sketches - the ollin command: run one .swift file as a sketch from anywhere, no package needed, or a package's sketch with every file of it reloading
  • The 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 visuals
  • Bringing a shader over - ollin new --from-shader: translate a GLSL fragment shader into Metal and get a project around it
  • Checking the machine - ollin doctor: what this machine can run, with the line that fixes each answer; shell completions, and --list-params for what a sketch declares
  • Checking a shader - ollin check: compile a .metal file on this machine's GPU and see the errors at your own line numbers, what kind of shader it is, and the parameters it reads
  • Bringing a scene over - ollin new --from-scene: a glTF or USD scene written out as the camera, lights and placement calls that draw it
  • Writing an extension - ollin new --kind extension: a library other sketches import, the ollinx- naming convention, and the seams to build on
  • Dragging 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 file
  • The reference offline - ollin docs, ollin examples, ollin api, and ollin 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 reference
  • Profiling - 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.

↑↓ move ↩ open