The reference offline
On this page
Everything in Docs/ and every sketch in Examples/ is already on your machine, in the checkout you build against. ollin docs and ollin examples read them from there, and ollin api reads the public surface, so looking something up takes one command instead of a browser, a network, and a search box.
ollin docs color
ollin examples flocking
ollin api drawCircleIt reads the checkout you are running, so the answer describes the version you build against rather than whatever is published somewhere. That also means you have the whole reference with no network, on a plane, on a train, or on a machine that is offline. When a browser is the better place to read, ollin site writes the same pages out as a website.
Reading a page
Name a page however you think of it. You can give a page name, a path, part of either, or a word from the description the index gives it:
ollin docs Color # the page
ollin docs Drawing/Color # the same page, by path
ollin docs reflectance # the page whose description says itAn exact match wins over a loose one, so color gives you the color page rather than the nine pages that mention color. When a word does fit several pages equally well, the command lists them with their descriptions so you can pick one:
"light" matches 2 pages:
Concepts/Light why color mixes in linear light, and what the last pass of a frame does
Drawing/Light Combine.light, the light that reaches every pixel of a flat scene ...Add a heading to go straight to one part of a long page:
ollin docs Color#ramp
ollin docs Drawing/Drawing#strokeAlignThe heading is matched the way you would say it, so backticks, capitals, and the dashes of a web anchor all work. If you name a heading that is not there, the command lists the page's headings instead.
With no topic at all, you get every page, grouped the way the reference groups them. That listing is the map:
ollin docsSearching it
Sometimes you know what you want to do but not what it is called. In that case, search the whole reference for a word:
ollin docs --search "long exposure"Each hit comes back with its page, its line number, and the heading it sits under:
Concepts/Light
29: (What follows from it) - Adding light works. blendMode(.add) with faint marks sums
the way light sums, which is what makes an accumulated canvas read as a long
exposure instead of a smear.
Concepts/Persistence
19: (Kept between frames) - The canvas, if you ask for it. noClear() stops the
per-frame wipe, so drawing piles up and background(_:) becomes the reset.You do not have to ask for the search. A topic that matches no page falls through to it anyway, so a wrong guess still gives you something useful.
The examples
The examples answer the other half of the question. They show you not what a call does, but what somebody built with it.
ollin examples # every sketch, grouped by folder
ollin examples ocean # the one you meant
ollin examples boids # matched on the description, not the name
ollin examples turan # matched on the credit in a sketch's headerAn exact name answers alone. Anything looser lists every sketch it fits. The ones named for the word come first, then the ones whose folder, description, header credit, or imports say it. So complex lists the sketch called ComplexPlane beside the ones described as complex arithmetic. The author of an article a sketch was written after finds every sketch that credits it.
One match prints what it shows, the credit its header carries, and how to run it:
3D/Geometry/Ocean
A sea built from its own wave spectrum. One inverse Fourier transform on the GPU
makes the surface, which is drawn as water with no geometry anywhere
(makeOceanField, drawOcean).
sketch Examples/3D/Geometry/Ocean/Sketch.swift
run swift run --package-path Examples Example-3D-Geometry-Ocean
read ollin examples 3D/Geometry/Ocean --source--source prints the sketch itself, which is often the fastest answer:
ollin examples ocean --sourceTo start your own project from an example rather than read it, hand the example to the generator. ollin new MyOcean --from 3D/ copies the sketch and everything beside it. See the project generator.
A name, and what it takes
When you know the name, or half of it, ollin api says what it is:
ollin api loopProgressSketch.loopProgress Ollin
func loopProgress(over: Double, phase: Double = default) -> Double
Sources/Ollin/Math/Math.swift:264
How far through a repeating loop the clock is: `0...1` over `duration`
seconds, wrapping back to `0` as each lap completes.
...
documented Helpers/Animation#looping-progress
used in Examples/Patterns/Apollonian/Sketch.swift:27
let phase = loopProgress(over: 8)It prints every declaration the name has as its source writes it, so the parameter names and the default values are there too. Under each is the file and line it is declared on, and the comment written above it. That comment is where a value's unit, range, and direction are written down. A declaration isolated to an actor carries it, as in @MainActor open class Sketch, and a member marked nonisolated keeps the word. Those say whether a call can run off the main thread, which the listing leaves out. When two declarations read alike, the line under each says what tells them apart. That is the where clause of the extension it sits in, or requirement for a protocol's own member. Then come the pages that document it, as addresses ollin docs opens, and the shortest examples that use it, for each type the name sits on. A type written mostly through its cases, like style: .segmented, is found through them.
The listings under API/ are where it reads from. Those are the whole public surface, one line per declaration, so a name that is not there cannot be reached from a sketch at all. ollin api answers "is it public?" as well as "what does it take?".
Put the type in front of the name to pick one out. A bare type lists everything on it:
ollin api Mesh.tube # the tube on Mesh, not the tube light
ollin api Param # every way to declare a parameter
ollin api Vector2.init # every way to make a Vector2A type's cases carry their comments in that list, because a case's comment is the whole of its documentation: ollin api Filter says under each mode what its parameters mean, in which units, and what it hands back at zero, without a lookup per case. A type with more than sixty members lists just their names, so ollin api Sketch fits on a screen. A name nothing is called prints the names spelled like it instead. That is the question you have when you know roughly what a call is called and not its exact spelling:
ollin api blom # Filter.bloom, and the others spelled like itIn a terminal, and in a pipe
The output is formatted for whoever is reading it. A terminal gets color and the width of your window. A pipe gets plain text, so the commands compose:
ollin docs --list | grep 3D # one topic per line
ollin examples --list | wc -l # one path per line
ollin docs color --plain > color.txtA page longer than the screen opens in your pager ($PAGER, or less), and --no-pager turns that off. --width sets the column width, --plain drops the color, and --color keeps the color through a pipe.
In a browser
You can also write the same pages out as a website:
ollin site # writes the site into .build/site
ollin site ~/Desktop/ollin # or into a folder you nameOpen the folder's index.html to start reading. The front page opens on the ring of breathing circles. That is the Examples/ sketch, exported as its own web page and played by that page's player. Its ink and paper are set to the site's own colors. The site opens on a sketch drawn the way the framework draws it. Under the ring, the front page shows part of the README. It has the opening, then Hello, circle, Run it, Install, and What's in it, laid out for a browser window. On a wide window the opening's facts stand beside its paragraphs as a ruled sheet. Run it runs in two columns, and the two ways to install stand side by side. On a phone everything stacks, and the words come before the ring. The Hello, circle program leads a band of sketches you page through with the dots under it. Each one runs beside the whole program that draws it. Only the sketch on screen plays, and the command under Run it names it. The whole README is the About page, and the front page ends with a link to every section it left there. The Guide has its chapter list beside it, and the reference is grouped the way its index groups it. Every example gets a page of its own with its source, and every picture the pages show is copied in. The menu beside an example lists its category's sketches. Some categories file their sketches in folders with a page of their own, as the Recreations do for each artist. There the menu lists those pages by title, and each page lists its sketches. A figure with a dark variant follows your system setting, and so does the site.
The site shows the same files rather than a second copy of them. A page's prose arrives exactly as the file spells it, and its links point at the same neighbors they do on GitHub. The site does not render every kind of file. A link to one it skips, such as a source file or a folder of figures, points at that file on GitHub instead. Paths mirror the repository in lower case, so Docs/ becomes docs/.
Every page reads the same way, whichever section it is in. It opens on one title, at one size, whatever level its file writes the title at. Its sections are set under that title, so the list on the right has a top level. The trail above the title starts at Ollin and names the section as the bar does: Guide, Reference, or Examples. An example's trail ends on the sketch. The examples menu lists the categories in the order the index shows them. The project pages go by short names in their menu, such as Changelog and Code of conduct, and each still opens on its own file's title. The changelog's list is its releases alone. Every picture and clip has a thin edge, so a white sketch does not float on a white page.
Every page has a search. Press /, or the command key with K, or the button in the bar, and type. It looks through the Guide, the reference, and the examples one section at a time. A page's title counts most, then its heading, then its first line, then the words of its prose. So color puts the color page first, and kuwa finds the brushwork filter by a word its prose uses. A typo in a longer word is forgiven, and every word you type has to match. A name is found with or without its accents, so bonacic finds Vladimir Bonačić. No page takes more than three rows, and the words that matched are marked. The index is written with the site as assets/, one entry per section. The matching runs in your browser through MiniSearch, a small open-source library. The page loads it from a content network the first time you search, pinned to one release and checked against its published hash. That is the one thing on the site that comes from outside it. A folder you opened off the disk with no connection has every page, and its search says the library did not load.
The pages are built to be read on a phone and from a keyboard. On a narrow screen a long call in code type folds between its labels, so no page is wider than the screen. A code listing or a table too wide for its column scrolls inside its own box. The first Tab on any page reaches a "Skip to content" link, which steps over the bar and the menu. Wherever the focus is, a ring in the page's ink shows it. Every picture's tag carries the picture's size, so its place is held before the file arrives. All but a page's first picture load as you come near them. A file in the checkout is read for its size when the site is built. A picture on the media host gets its size from Media/media.json.
The lists beside a page follow you. The menu on the left opens on the page you are reading, wherever that page sits in it. The list on the right marks the section on screen as you scroll, and it keeps that entry in view when the list is long. A list longer than its window fades at the edge it runs past, and near a page's end both stop at the foot. Where the screen is too narrow for the right-hand list, the same list folds under the page's title. On a phone the tab of the section you are in carries a small arrow. It opens that section's menu as a sheet under the bar, on the row of the page you are reading. The tab again, or Escape, closes it. A chapter ends on two cards, the chapter before and the chapter after, made from the chapter's own last line. With scripts off the lists are plain links, and a phone has the menu under the page.
A block of code can be copied. A button appears on the block while the pointer is over it, and pressing it copies the block as written. On a phone the button appears once you touch the block. A block with a line too long for its column fades at that edge, which says it scrolls. A heading shows a small link while the pointer is over it. The link goes to that section, and pressing it also copies the section's address. A chapter opens on its picture at the full width of the column, the size a chapter's opening clip plays at.
Every page ends on the same foot. It holds the mark, the newest release with a link to its notes, the three sections, and every project page. The release is read from the changelog, so the foot follows the next release with nothing to edit.
A wrong address gets a page in the site's own look, with the search and the three sections. The site writes it as 404.html. A host serves that one file at any depth, so every path in it starts at the site's root. The site has to know its own address for that, so the file is written with --domain, or when the repository is on GitHub.
--domain ollin.art writes the CNAME file for a custom domain, and it makes every page's canonical address absolute. A link to a page unfurls with a picture, in a message or a feed. An example's is its own still. A chapter's is the picture the chapter opens on. Every other page shows the mark, from Logo/, which Scripts/logo.sh writes from the logo's master. A square picture is shown small and whole, since a feed would cut a large one to a wide strip. The repository's own workflow (.github/) runs the same command and publishes the result to GitHub Pages.
For an assistant
An assistant helping somebody write a sketch reads the same pages, and two files give it a way in. llms.txt at the root of the checkout maps the reference in one line a page, following the llms.txt convention. It says what Ollin is, gives the three commands above and the quick reference to read first, then lists every Guide chapter and reference page. Its links are paths in the checkout. Scripts/llms.sh writes it from the pages themselves, and preflight fails when a page's title or its line in the index has moved on without it.
The website carries a map of the same shape at its own root. Every page there has a markdown twin at the same address, with .md in place of .html, so a tool that follows a link keeps reading markdown. Each page's head names both.
What it is not
The commands print pages for a person to read. The two maps above point at those pages rather than holding a copy of them. The site's search index is for the page's own script, and holds headings and first lines rather than a copy of the reference. There is no server answering questions about the reference. Whether Ollin should run one is an open question, and nothing here takes a position on it.
See also
- Reference index: the same map, in a browser
- Examples: the sketches, by category
- Project generator: starting a project from a template or from an example
- Single-file sketches: the rest of what the
ollincommand does - Ollin quick reference: the framework on one page, the first thing to read