Template Expressions
Use {{ expression }} syntax in layer properties (content, src, color, etc.) to make templates dynamic. Expressions can reference brand tokens, variables, and call helper functions.
Rich text variables
A variable of type Rich text ({ "type": "string", "format": "richtext" }) carries inline formatting: bold, italic, underline, strike, colour and highlight — the same controls the canvas text editor has. Its value is a string in a small HTML subset:
Save <b>20%</b> on <font color="#ff0000">everything</font> <mark color="#fde047">today</mark>
Bind it like any other variable, {{ headline }}, in a text node. At render time the markup becomes styled runs on that node; the rest of the node's text and its base style are untouched. Supported tags: <b>, <i>, <u>, <s>, <font color="#hex">, <mark color="#hex">, <br>. Anything else is dropped as a tag and its text kept. Nothing is ever rendered as HTML — the value is drawn as glyphs on the canvas.
<mark> draws a highlight box behind the run. With a colour it is that colour; a bare <mark> takes the text layer's own first highlight colour (set in the editor's Highlight section), so a designer picks the marker once and the value only says which words get it. Padding, corner radius and opacity come from the layer's highlight, not the markup — for every <mark>, coloured or bare. Switch that highlight layer off when it should only style the marks: a disabled layer still sets the marker, but no longer draws a box behind every line of the text. Its colour may be an expression, such as {{ use(brand.colors.primary, '#fde047') }}, so marks follow the brand.
The same markup works in a list: a repeat row's {{ item.body }} renders it, and a list variable whose example rows carry markup gets the formatting toolbar for that field. Live expression bindings on a text layer's content are parsed the same way.
The form on a template's page and the Variables panel (the editor's Data tab) show a rich field for these; the render API and MCP accept the same string in variables.
Code variables
A variable of type Code ({ "type": "string", "format": "code" }) holds a source snippet. The form on a template's page and the Variables panel show it as a multiline monospace field that keeps newlines and indentation (a plain string field is one line). Through the render API and MCP it is an ordinary JSON string with \n newlines.
Bind it to a code layer with the whole value as one expression — codeText: "{{ code }}", and likewise codeLang and codeTheme. Only a value that is exactly one {{ … }} is resolved, so a snippet that merely contains mustaches (a Vue template, a Handlebars partial) prints as written.
Shader variables
A variable of type Shader ({ "type": "object", "format": "shader" }) holds a workspace shader and the values of its inputs: { "id": "<shader id>", "inputs": { "tint": "#00ff00", "speed": 2 } }. A shader layer bound to it swaps its whole program per render and takes those input values. On the template's page and in the Variables panel the field is a picker over the space's approved shaders and the ones published by any workspace, with the picked shader's inputs (colours, sliders, palettes, dropdowns) right under it. Through the render API, MCP and bulk rows the value is that object, or just the id string (list_shaders lists them) for the shader as designed.
In the editor, select the shader layer and click Variable at the top of its inputs: that declares the variable seeded with the current shader and binds the layer (bindings: { "shaderId": "background" }). Agents do the same with setVariables { type: "shader" } plus an updateNode carrying that binding.
Rules:
- The value is only ever an id. Raw shader source never travels in a variable, so nothing bypasses vetting.
- A render may use the template space's own approved shaders and any published shader. Any other id, a revoked shader, or a typo leaves the layer on the program it was saved with — a wrong value degrades to the design's default, never to a blank.
inputsare keyed by the shader's input names and apply over the layer's values; anything not named keeps the layer's value where the shader declares the same input, else that shader's default. Values are clamped to the manifest like any other shader input.- The variable's default is the layer as designed (its shader and current inputs), so a render without overrides is the design itself.
Signature variables
A variable of type Signature ({ "type": "string", "format": "signature" }) holds a signature image. On a template's page and in the Variables panel the field is a signature pad with three tabs:
| Tab | What the signer does |
|---|---|
| Draw | Signs with a mouse, pen or finger. Undo removes the last stroke. |
| Type | Types their name and picks one of three handwriting styles. |
| Upload | Picks a scan or photo of a signature. |
Black, navy or blue ink can be chosen on every tab. The signature is a transparent PNG, cropped to the ink:
- Signed in, with an active workspace: the PNG is uploaded to that workspace's files, and the variable's value becomes the file's URL. Saved values stay small, and every render (PNG, PDF, API, bulk) uses the hosted image.
- Signed out (or in an embed): nothing is uploaded. The value is the PNG as a
data:image/png;base64,…string, which renders the same way.
Bind it into an image layer's source:
src: {{ signature }}
The render API and MCP accept a PNG/SVG data URL or any https:// image URL for the same variable. To leave the signature line empty when no one has signed, give the image layer the condition isDefined(signature). An empty value drops the layer.
Fallbacks for optional brand assets
Brand tokens (logos, colors, images) may not always be defined. Use use or isDefined to provide fallbacks so templates work when assets are missing.
use (fallback chain)
Returns the first value that is set: not null, not undefined and not an empty string. A form field left blank, or a variable a caller sends as "", falls through to the next value. Use it for optional logos, colors, or images. Use function call syntax with parentheses and commas.
{{ use(brand.logos.logo, brand.logos.icon) }}
{{ use(brand.colors.primary, "#333333") }}
{{ use(at(brand.images.backgrounds, 0).url, "https://picsum.photos/1200/630") }}
If brand.logos.logo is defined, it's used. Otherwise brand.logos.icon. If both are empty, returns "".
isDefined (alias)
Same as use: returns the first value that is set, or "" when none is. In a condition (if), it is true when any of its arguments is set.
{{ isDefined(brand.logos.logo, default.logo) }}
Math functions
| Function | Example |
|---|---|
| min | {{ min(a, b) }} |
| max | {{ max(a, b) }} |
| abs | {{ abs(x) }} |
| round, ceil, floor | {{ round(3.7) }} |
| clamp | {{ clamp(value, 0, 100) }} — clamps value between min and max |
Text functions
Strings are counted by character (code point), so an emoji or an accented letter is one step.
| Function | Example |
|---|---|
| slice(text, start, end?) | {{ slice(url, 0, 5) }} — part of a string (or list). Negative indexes count from the end; end is exclusive and optional. "" for anything that is not text or a list. |
| len(text) | {{ len(headline) }} — characters in a string, items in a list, 0 otherwise |
| upper(text), lower(text) | {{ upper(cta) }} — change case |
| padStart(text, length, fill?), padEnd(text, length, fill?) | {{ padStart(day, 2, "0") }} → 05 (fill defaults to a space, length caps at 1000) |
Typewriter. Bind a text layer's text to a slice that grows with $time. This types headline out between 0.4 s and 1.6 s:
{{ slice(headline, 0, floor(clamp(($time - 0.4) / 1.2, 0, 1) * len(headline))) }}
Put the text and a caret in a row auto-layout and the caret follows the end of the typed text.
Randomness
Use these to scatter rotations, jitter positions, pick a color from a palette, or generate placeholder numbers.
Why every random function takes an optional
seed: in the editor, expressions re-evaluate on every keystroke. An unseededrandom()would reshuffle on every change, so rotations / picks would jump around as you type. Pass a stable seed string (a layer name, a loop index, anything unique-but-fixed) and the result locks in across re-renders.
| Function | Returns | Example |
|---|---|---|
random() | float in [0, 1), changes every render | {{ random() }} |
random(seed) | float in [0, 1), stable per seed | {{ random('hero') }} |
randomInt(min, max) | inclusive integer in [min, max] | {{ randomInt(1, 6) }} |
randomInt(min, max, seed) | same, deterministic | {{ randomInt(1, 100, 'card-1') }} |
randomFloat(min, max) | float in [min, max) | {{ randomFloat(-3, 3) }} |
randomFloat(min, max, seed) | same, deterministic | {{ randomFloat(-3, 3, 'speaker-card') }} |
randomChoice(items) | one element from an array | {{ randomChoice(palette) }} |
randomChoice(items, seed) | same, deterministic | {{ randomChoice(palette, 'hero') }} |
Rules:
- Reversed or zero-width ranges collapse to the lower bound.
randomInt(10, 5)is treated asrandomInt(5, 10).randomFloat(7, 7)returns7. - Non-numeric
min/maxfall back to0. UsetoNumber(...)if your bounds come from currency / formatted strings. randomChoiceonly accepts arrays from context — template variables, brand-token paths, loop sources. Array literals like[1, 2, 3]are not allowed inside expressions; put them on a variable instead.- A seed of
''(empty string),null, orundefinedis the same as no seed — the function will useMath.random().
Common patterns
Random rotation jitter, locked per layer (so the editor stays stable):
{{ randomFloat(-3, 3, 'speaker-card') }}deg
{{ randomFloat(-3, 3, 'event-card') }}deg
Pick a brand color from a palette held on a variable:
{{ randomChoice(brand.colors.palette, 'accent-1') }}
A “d6” roll on every preview (no seed → re-rolls every render):
{{ randomInt(1, 6) }}
Combine with a loop index inside a repeater so each iteration gets its own jitter:
randomFloat(-2, 2, 'sticker-' + itemIndex)
Calendar & date helpers
Month arguments are 1–12. Calculations use UTC. You cannot write array literals ([ ]) inside expressions; use the helpers below.
Loop source vs {{ }} in layer fields
| Where you use it | What happens |
|---|---|
| Loop source (repeater “Source” field) | The resolved value must be an array (or object). Put a variable path, a bare helper call (monthDayNumbers(year, month)), or one whole {{ expression }} there. Each item drives one iteration. |
{{ … }} in content, src, colors, etc. | The result is turned into a string for display. Arrays become comma-separated text (usually not what you want for a full list—use a repeater instead). Numbers and short strings render cleanly. |
Returns an array (for Loop source—or nested inside another helper)
Use these as the repeater source, or inside another call (e.g. range(1, daysInMonth(year, month)) uses the scalar daysInMonth inside an array helper).
| Function | Returns | Example Loop source | Notes |
|---|---|---|---|
range(count) | [0, …, count - 1] | range(7) | Seven columns (indices 0–6). |
range(start, end) | Inclusive integers | range(1, 31) | Often combined with daysInMonth (below). |
monthDayNumbers(year, month) | [1, …, lastDay] | monthDayNumbers(2026, 5) or monthDayNumbers(year, month) | One iteration per day in that month. |
yearRange(startYear, endYear) | Sorted inclusive years | yearRange(2020, 2030) | Year picker–style lists (length capped). |
calendarMonthSlots(year, month, weekStartsOn?) | 42 entries | calendarMonthSlots(2026, 5, 1) | null = empty cell; 1–31 = day of month. weekStartsOn: 0 Sun … 6 Sat; omit or use 1 for week starting Monday. |
monthNames() | 12 long names | monthNames() | Header row for months (iterate item + itemIndex). |
monthNamesShort() | 12 short names | monthNamesShort() | Compact month labels. |
weekdayNames() | 7 long names | weekdayNames() | Sun–Sat labels. |
weekdayNamesShort() | 7 short names | weekdayNamesShort() | Matches well with range(7) row layout if order aligns with weekStartsOn. |
Repeater source examples (bare form; wrapped {{ … }} with the same inner expression is equivalent):
range(7)
monthDayNumbers(2026, 5)
monthDayNumbers(year, month)
calendarMonthSlots(2026, 5, 1)
calendarMonthSlots(year, month, 1)
yearRange(2020, 2030)
weekdayNamesShort()
Inside repeated layers, use your item variable (e.g. day, slot) and dayIndex / slotIndex as in the editor binding reference.
Returns a single value (for {{ }} text/numbers—or inside array helpers)
| Function | Returns | Example in {{ }} |
|---|---|---|
daysInMonth(year, month) | Number of days (integer); 0 if invalid | {{ daysInMonth(2026, 5) }} → 31 |
daysInAMonth(year, month) | Same as daysInMonth | {{ daysInAMonth(year, month) }} |
Scalar inside an array helper (still one expression; no literal [ ]):
range(1, daysInMonth(year, month))
That produces an array from 1 through the last day—useful as a Loop source when monthDayNumbers(year, month) would do the same more directly.
What not to expect from {{ arrayHelper() }}
Expressions like {{ monthDayNumbers(2026, 5) }} or {{ weekdayNamesShort() }} evaluate to arrays but display as a single string (values joined with commas). For UI layouts, point the Loop source at the same helper (or a variable holding the array), not only {{ }} on one text layer.
Layer repeaters still accept variable paths (items, users.list) when they resolve to a non-null value—same resolution order as documented in the editor.
repeat and if also work on a scene: a repeated scene renders one page per item (with {{ index }} and the item name inside it), and a scene whose if is false is left out. See Pages from data.
Number parsing (currency / formatted strings)
When prices come in as strings like "$1,234.50", "₦12,500", or "(1,200)" you can convert them to plain numbers with toNumber (alias parseNumber):
| Function | Returns | Example |
|---|---|---|
toNumber(value) | Parsed number, or 0 if not parseable | {{ toNumber('$1,234.50') }} → 1234.5 |
toNumber(value, fallback) | Parsed number, or fallback if not parseable | {{ toNumber(price, 0) }} |
parseNumber(value) | Alias for toNumber | {{ parseNumber('₦12,500') }} → 12500 |
What gets stripped before parsing:
- Currency symbols:
$ € £ ¥ ₦ ₹ ₽ ₩ ¢ ฿ ₪ ₫ ₱ ₴ ﷼and trailing/leading codes likekr,USD,EUR,GBP,JPY,NGN,INR,RUB,KRW,CNY,CAD,AUD,CHF - Thousands commas (en-US convention):
"1,234,567.89"→1234567.89 - Spaces, including narrow no-break (
\u202F) and thin (\u2009) - Trailing percent:
"50%"→50 - Accounting parentheses for negatives:
"(1,200)"→-1200
sumItems already applies this normalization internally, so {{ sumItems(details.items, 'price.new') }} works even when price.new is "$1,234.50". Use toNumber explicitly when you need a single value (e.g. multiplying by a tax rate).
{{ toNumber(invoice.subtotal) * 1.1 }} // works even if subtotal is "$199.99"
{{ toNumber(invoice.discount, 0) }} // safe default when blank
{{ round(toNumber(price.new) - toNumber(price.discount)) }}
Number and money formatting
To display a number, format it instead of assembling separators by hand. These return strings, accept the same formatted input as toNumber ("$1,234.50", "2,000"), and return "" when the value is blank or unparseable.
| Function | Returns | Example |
|---|---|---|
money(value) | US dollars, 2 decimals | {{ money(1234.5) }} → $1,234.50 |
money(value, currency) | ISO 4217 code (EUR, NGN, JPY…) or a literal symbol prefix (₦) | {{ money(12500, '₦') }} → ₦12,500.00 |
money(value, currency, locale) | Locale separators and symbol position | {{ money(1234.5, 'EUR', 'de-DE') }} → 1.234,50 € |
money(value, currency, locale, decimals) | Fixed decimals (0–6) | {{ money(total, 'USD', 'en-US', 0) }} → $1,235 |
formatNumber(value, decimals?, locale?) | Thousands grouping; up to 2 decimals unless fixed | {{ formatNumber(12000) }} → 12,000 |
compactNumber(value, locale?) | Abbreviated count | {{ compactNumber(2500000) }} → 2.5M |
{{ money(sumItems(items, 'amount') * (1 + toNumber(taxRate, 0) / 100), currency) }}
{{ formatNumber(stats.downloads) }} downloads
{{ compactNumber(followers) }} followers
An unknown or malformed locale falls back to en-US.
Strings using , as the decimal mark (e.g. "1.234,56") are not auto-converted — they're ambiguous against the en-US thousands convention. Normalize on input or replace the comma yourself first.
Array reducers (sums, joins)
For invoice-style layouts and lists where you need a total or a single string built from a repeater's source, use sumItems and joinItems. Both take the same array you would use as a loop.source (so reach for them via the variable path, e.g. details.items).
| Function | Returns | Example |
|---|---|---|
sumItems(items) | Total of numeric items | {{ sumItems(amounts) }} → sum of a number[] |
sumItems(items, path) | Total of path read from each item | {{ sumItems(details.items, 'price.new') }} |
joinItems(items) | Items joined with ", " | {{ joinItems(tags) }} |
joinItems(items, path) | path from each item, joined with ", " | {{ joinItems(speakers, 'name') }} |
joinItems(items, path, sep) | Custom separator | {{ joinItems(speakers, 'name', ' • ') }} |
Aliases sumLoopItems and joinLoopItems exist for parity with the loop.source mental model — they take the exact same arguments.
For invoices where callers provide quantities and rates, use lineAmount(quantity, rate, decimals=2) for each row and sumLineAmounts(items, quantityPath="quantity", ratePath="rate", decimals=2) for the subtotal. The subtotal sums the individually rounded lines in integer minor units, so it agrees with the displayed rows. Rounding is half away from zero; negative lines can represent credits. Precision supports 0–6 decimal places; amounts exceeding safe integer precision are rejected. Missing or unparseable numeric inputs contribute zero. These helpers read only own item properties and reject prototype paths.
Line: {{ money(lineAmount(item.quantity, item.rate), currency, 'en-US', 2) }}
Subtotal: {{ money(sumLineAmounts(items), currency, 'en-US', 2) }}
Tax: {{ money(lineAmount(1, sumLineAmounts(items) * taxRate / 100), currency, 'en-US', 2) }}
Use the same precision for line calculations, the subtotal and display formatting. Apply discounts before percentage tax when that is the invoice's stated policy, and subtract payments from the invoice total to calculate the remaining balance. Callers supply raw inputs rather than maintaining duplicate line or invoice totals.
Rules:
- Non-array inputs return
0(sum) or""(join). null,undefined, and empty-string values are skipped — so a missing field never produces", , "gaps.sumItemsaccepts currency-formatted strings out of the box ("$1,234.50","₦12,500","(1,200)"for negatives). See Number parsing for the exact rules; truly non-numeric values are skipped.pathis a dot path ("price.new","address.city"); omit it when the array holds primitives directly.
Common patterns:
Total: {{ sumItems(details.items, 'price.new') }}
Net: {{ sumItems(details.items, 'price.new') - sumItems(details.items, 'discount') }}
Tags: {{ joinItems(tags) }}
Hosts: {{ joinItems(speakers, 'name', ' • ') }}
You can wrap reducers in other safe functions:
{{ round(sumItems(details.items, 'price.new') * 1.1) }} // 10% tax, rounded
{{ clamp(sumItems(orders, 'qty'), 0, 999) }} // sum capped to 3 digits
Sort, filter and de-duplicate lists
sortBy, filterBy and unique return a new list, so they work anywhere a list does: as a repeater's source (line items in alphabetical order, only the paid invoices), inside sumItems / joinItems / count, or in first / at. They never change the variable itself.
| Function | Result | Example |
|---|---|---|
sortBy(items, path?, dir?) | The list ordered by path (or by the items themselves). dir is "asc" (default) or "desc". | sortBy(items, 'name') |
filterBy(items, path, value) | The items whose path equals value. value may be a list: an item matches any of them. | filterBy(invoices, 'status', 'paid') |
filterBy(items, path) | The items where path is filled in (not blank). | filterBy(team, 'photo') |
unique(items, path?) | The list without repeats, keeping the first of each; with a path, compared by that value. | unique(attendees, 'company') |
How values compare:
- Numbers and number-like text compare by value, so
"$1,200"comes after"$900"and"9"before"10". - Text sorts A to Z ignoring case, with numbers inside text in natural order (
Item 2beforeItem 10). - Blank values (missing,
null, empty text) always sort last, in both directions. filterBycompares as text, so9matches"9".- A path reads only the item's own fields; a list longer than 1,200 items is cut to its first 1,200.
As a repeater source (the repeat field takes the expression without braces):
repeat: sortBy(items, 'name')
repeat: sortBy(products, 'price', 'desc')
repeat: filterBy(team, 'role', ['Lead', 'Manager'])
In a text layer:
Paid: {{ count(filterBy(invoices, 'status', 'paid')) }}
Top seller: {{ first(sortBy(products, 'sold', 'desc')).name }}
Companies: {{ joinItems(unique(attendees, 'company'), 'company') }}
Color functions (chroma-js)
All color functions accept hex, named colors, or brand token paths like brand.colors.primary.
Light / dark
| Function | Description | Example |
|---|---|---|
| lighten | Lighten a color | {{ lighten(brand.colors.primary, 1.5) }} |
| darken | Darken a color | {{ darken(brand.colors.primary, 2) }} |
| saturate | Increase saturation | {{ saturate(brand.colors.accent, 2) }} |
| desaturate | Decrease saturation | {{ desaturate(brand.colors.primary, 1) }} |
| getLuminance | 0 (black) to 1 (white) | {{ getLuminance(brand.colors.primary) }} |
| isLight | True if luminance > 0.5 | {{ isLight(brand.colors.primary) }} |
| isDark | True if luminance < 0.5 | {{ isDark(brand.colors.primary) }} |
Mixing and blending
| Function | Description | Example |
|---|---|---|
| mix | Mix two colors | {{ mix(brand.colors.primary, brand.colors.accent, 0.3) }} |
| shade | Mix with black | {{ shade(brand.colors.primary, 0.5) }} |
| tint | Mix with white | {{ tint(brand.colors.primary, 0.5) }} |
| blend | Blend modes (multiply, darken, lighten, screen, overlay, burn, dodge) | {{ blend(c1, c2, "multiply") }} |
| average | Average of colors | {{ average([c1, c2, c3]) }} |
Scales and gradients
| Function | Description | Example |
|---|---|---|
| scaleColors | Color at position (0–1) or array of n colors | {{ scaleColors([brand.colors.primary, brand.colors.accent], 0.5) }} |
| scaleColors | Get 5 colors from gradient | {{ scaleColors(["#ff0000","#0000ff"], 5) }} |
Other color helpers
| Function | Description | Example |
|---|---|---|
| alpha | Set opacity (0–1) | {{ alpha(brand.colors.primary, 0.5) }} |
| luminance | Set luminance (0–1) | {{ luminance(brand.colors.primary, 0.5) }} |
| contrast | WCAG contrast ratio (4.5+ for text) | {{ contrast(brand.colors.primary, brand.colors.neutral100) }} |
| hex | Get hex from any color | {{ hex(brand.colors.primary) }} |
| colorCss | Get rgb/rgba string | {{ colorCss(brand.colors.primary) }} |
| colorValid | Check if valid color | {{ colorValid(brand.colors.primary) }} |
| temperature | Color from Kelvin (2000=candle, 6500=daylight) | {{ temperature(3500) }} |
Brand token paths
| Path | Use case |
|---|---|
| brand.logos.logo, brand.logos.icon | Image src for logos |
| brand.logos.wordmark | Wordmark alone |
| brand.colors.primary, brand.colors.secondary, brand.colors.accent | Brand colors (secondary falls back to accent, then primary) |
| brand.colors.primary50 … brand.colors.primary950 (also secondary*, accent*) | Derived tint-to-shade steps: 50, 100, 200 … 900, 950 |
| brand.colors.onPrimary, onSecondary, onAccent | Derived text colour for copy on that fill (≥ 4.5:1) |
| brand.colors.neutral100 … brand.colors.neutral900 | Neutral ramp: low steps for backgrounds, high steps for text |
| brand.colors.success, error, warning, info | Functional colors |
| brand.colors.successBg, successBorder, successText (also error*, warning*, info*) | Derived status background, border and text (text reads on Bg) |
| brand.colors.chart1 … brand.colors.chart6 | Derived distinct series colours, brand roles first |
| brand.typography.heading, brand.typography.body | Font families |
| brand.images.lifestyle, product, people, screenshots, backgrounds, cutouts, places | Image lists — at(list, 0).url, .name, .role; randomChoice(list, seed); withTag(list, 'speaker') |
| brand.copy.tagline, brand.copy.description | Text content |
| brand.copy.website | The brand's website as printed on creatives, e.g. northwind.com (host only, no protocol) |
| brand.look.margin | Safe margin, px at 1080 (use with brandPx) |
| brand.look.spacing.xs, sm, md, lg, xl, xxl | Spacing steps, px at 1080: gaps and padding (use with brandPx) |
| brand.look.alignment | Default text alignment: left, center or right |
| brand.look.radius.button, card, image, badge, avatar | Corner radius per role: px or "full" (use with brandRadius) |
| brand.typography.styles.display, h1, h2, body, caption, label | Complete type style: font, weight, size (px at 1080), lineHeight, letterSpacing (em), case, plus fontFamily and textCase |
| brand.typography.scale | Ratio between type-scale steps |
| brand.logos.rules.logo, icon, wordmark | { clearSpace, minSize, horizontal, vertical } per logo version (use with brandLogoPlace) |
| brand.look.shadow.sm, md, lg | Shadow levels (use with brandShadow) |
| brand.look.gradients.primary, accent, background | Brand gradients (use with brandGradient) |
| brand.look.border, overlay, texture, glass | Border, photo scrim, grain, frosted glass |
| brand.look.filters.lifestyle, product, people, screenshots, backgrounds, cutouts, places | CSS filter string per image category (use with brandFilter) |
Page tokens
Every page of a still multi-page template (a carousel, a deck, a card's front and back — see Pages) knows where it sits. In {{ }} text, bindings and conditions:
| Token | Value |
|---|---|
page.number | 1-based position of the page, after scene Repeat and Show if are applied |
page.index | the same, 0-based — the scene a single render of this page takes |
page.name | the page's resolved name (a templated scene name is filled in) |
pages.count | how many pages the template renders with the current values |
{{ page.number }} / {{ pages.count }} on a slide reads 3 / 7; a scene dropped by Show if shifts the pages after it. The tokens are not available inside a scene's own Show if (which decides whether the page exists). They are reserved names: a template variable called page or pages wins over them, and the token is simply absent. They differ from {{pageNumber}} / {{totalPages}}, which count the pages a single scene splits into under PDF auto-pagination.
Layer bindings
A layer's bindings map a property to an expression: { "gapX": "20 * min($scene.width / 1080, 1)" }. The engine evaluates every binding on every frame, and a bound value wins over keyframes and the static value. Numeric properties (x, w, opacity, gapX, padX, strokeW, …) only take a finite number; a dotted key such as fills.0.color or shaderUniforms.speed writes into the paint or shader-input stack; any other key (text, src, svg, codeText) gets the value as-is.
In the editor, select one layer and open Automation in the inspector. The Bindings list there shows every binding on the layer, including ones written over MCP or by the AI that have no property row, like svg, codeText, dotted paint paths or the legacy left/top aliases. Edit an expression and press Enter to apply it. To remove a binding, press its minus button or clear the expression. To add one, pick or type a property in the last row (dotted paths work), type the expression and press Enter.
Typing {{ expression }} into a numeric property field creates the same binding, which then shows in the list.
Operators available in expressions and bindings: + - * / % **, comparisons < <= > >=, equality === !== and == !=, logic && || !, and the ternary a ? b : c. == / != compare plain values loosely (3 == "3" and null == undefined are true) and lists or objects by identity — no other JavaScript coercion. Bitwise operators, assignment and the comma are not supported. A binding that cannot be parsed shows the layer's static value; over MCP, apply_template_ops reports it in that operation's warnings so it does not fail silently.
Brand shape and effects
Radii, shadows, gradients and borders are numbers or whole stacks, not text. Set them through a layer's bindings, not through {{ }}.
The brand stores px as authored for a canvas whose short side is 1080 px. Pass $scene and the helper scales the value to the canvas being rendered. Without $scene, the value is used as authored.
| Helper | Returns | Example binding |
|---|---|---|
brandRadius(value, $scene?) | Number. "full" becomes a pill or circle | radius: brandRadius(use(brand.look.radius.button, 12), $scene) |
brandPx(value, $scene?) | Number | strokeW: brandPx(12, $scene) |
brandFilter(filter, $scene?) | { brightness, saturation, blur, effects, css } | brightness: brandFilter(brand.look.filters.lifestyle).brightness; effects: brandFilter(brand.look.filters.lifestyle, $scene).effects |
brandShadow(level, $scene?) | Effects stack | effects: brandShadow(brand.look.shadow.md, $scene) |
brandTexture(texture, $scene?) | Effects stack (grain) | effects: brandTexture(brand.look.texture, $scene) |
brandGlass(glass, $scene?) | Effects stack (background blur) | effects: brandGlass(brand.look.glass, $scene) |
brandGradient(gradient) | Fill stack | fills: brandGradient(brand.look.gradients.primary) |
brandOverlay(overlay) | Fill stack (tint or fade) | fills: brandOverlay(brand.look.overlay) on a rect above a photo |
brandBorder(border, $scene?) | Stroke stack | strokes: brandBorder(brand.look.border, $scene) |
brandLogoPlace(rule, $self, $scene) | { x, y, margin, minHeight }. The logo in its preferred spot, clear space kept from the canvas edge | x: brandLogoPlace(brand.logos.rules.logo, $self, $scene).x, y: ….y; constrainH: brand.logos.rules.logo.horizontal, constrainV: brand.logos.rules.logo.vertical |
brandText(brand.typography, style, $scene?) | { fontFamily, fontSize, fontWeight, lineH, letterSpacing, textCase, italic } | fontSize: brandText(brand.typography, 'h1', $scene).fontSize (same for fontWeight, lineH, letterSpacing); italic: brandText(brand.typography, 'display').italic; fontFamily: {{ brandText(brand.typography, 'h1').fontFamily }} so the font loads |
brandCase(text, brand.typography, style) | The text in the style's case (sentence / title / upper / lower), rich-text tags kept | text: brandCase(headline, brand.typography, 'h1') |
brandLogoSpace(rule, logoHeight) | Number: the clear space in px for a logo drawn that tall | A logo container's padT / padR / padB / padL, or the gap between the logo and partner logos: brandLogoSpace(brand.logos.rules.logo, 64) |
concat(a, b, …) | One list | effects: concat(brandShadow(brand.look.shadow.sm, $scene), brandTexture(brand.look.texture, $scene)) |
- Missing values: every helper returns an empty stack or 0 when the brand has no value. Wrap the token in
use()when a fallback matters. - Flat brands: a brand whose shadow style is
nonegets no shadow. Don't hardcode one to make up for it.
Best practices
- Always use fallbacks for optional assets —
{{ use(brand.logos.logo, brand.logos.icon) }}so the template works when a logo isn't set. - Use isLight/isDark for text contrast — Pick light or dark text based on background:
{{ isDark(brand.colors.primary) ? "#ffffff" : "#000000" }}(if your expression syntax supports ternaries). - Use contrast() — Ensure text readability: aim for 4.5:1 or higher.
- scaleColors for gradients — Generate consistent color ramps from brand colors.