Make a glyph
A glyph is a QR code whose text tells QRX what to show. Point the code at a document on the web, or put a small document inside the code itself. Everything here runs in your browser: nothing you type is sent anywhere.
Generator
The payload
The text in the code is a few lines, in any order, up to the first blank line. A typical one:
size: *3
https://qrx.apphaus.us/glyphs/ui-login.json
| Line | What it does |
|---|---|
https://… | Where the glyph document lives. QRX fetches it when it sees the code. |
blue://device/path | Fetch the document over Bluetooth from another QRX device nearby, by its Bluetooth name. No internet needed. |
size: … | How big to show the content next to the code. See Sizes. |
multi | The same code may be shown several times in the room. |
name: value | Any other header. QRX keeps it with the glyph; a single word on its own counts as a flag. |
Anything after the first blank line is the body. When there is no address, the body is the
glyph document itself, so the code works with no network at all. Put at least one line (a
size: line will do; size: ~ means the default) before the blank line, so QRX knows
where the header ends. The generator above does this for you.
size: ~
{"_button":{},"text":"Hello!","action":{"name":"toast","args":{"message":"Hi from QRX"}}}
A code that isn't in this format still does something: a plain web address is treated as the document's address, and any other text is shown as text.
Sizes
A size is width x height, or one value for both, counted in code widths: *2 is
twice the code. A number without the * is in code units, which the apps also take to
be one code width. The default is the size of the code itself.
| Size | Means |
|---|---|
size: *2 | Twice the code, centred on it. |
size: *3x*2 | Three codes wide, two high. |
size: 10l10x20b10 | 10 units wide, hanging from the code's left edge and moved 10 along; 20 high, hanging from the bottom edge and moved 10. |
size: *2:active | Twice the code, while the glyph is active. |
size: ~ | The default. |
After a number you may add an anchor, the edge of the code the content hangs from:
l, c or r for the width, t, c or
b for the height, then an offset from that edge. A trailing
:normal, :fixed, :focus or :active says which state the
size is for; give several size: lines to size each state.
The phone apps assume a printed code is about 6 cm wide when they turn these numbers into real sizes, so print at 6 cm for the sizes to come out as written.
Glyph documents
A glyph document is a JSON object with one key starting with _ that names its type. That key's
value holds options; the other keys are the content.
| Type | Shows | Fields |
|---|---|---|
_image | A picture | url |
_avplayer | A video | url; option loop |
_web | A web page | url |
_button | A button | text, and an optional action |
_ui | A form, or a 3D scene | A JsonUI document: _ui holds its state and script, the other keys are the layout |
{
"_avplayer": { "loop": true },
"url": "https://example.com/clip.mp4"
}
Forms are JsonUI documents: stacks of text, fields, toggles, pickers and buttons, with
state and small scripts for live checks. Their buttons can call toast (show a message),
open (open a web address) or dismiss. QRX.pack's
survey and
sign-in form are good
places to start.
Scenes are _ui documents whose root has "type": "Scene": actors
with bodies (a glTF model and its animations), sounds and minds, standing on the code or on the floor. See
the singing bush and
Rusty and Pip.
A type QRX doesn't know shows as a placeholder with the type's name.
Sharing pieces between glyphs
A document can pull in pieces of other documents with { "$ref": "shared/fields.json#/email" }.
A relative reference is resolved against the document's own address; #name refers to
_ui.fragments.name in the same document. QRX fetches every piece (up to 16 documents) before
it shows the glyph. A piece's keys replace the matching keys next to the $ref, one level deep.
Inline documents have no address, so they can only use absolute references.
Where to put your documents
- Any web server that answers with the JSON over
https://: GitHub (the raw file address), a static host, your own site. QRX only fetcheshttp(s)://andblue://addresses. - Changing the document changes what every printed copy of the code shows. To change a glyph without changing old prints, publish a new file.
- Everything in a glyph is visible to whoever scans it. Don't put secrets in a document or a code.