Docs

Defines and Macros

A define is a named value. Top-level defines are global; defines inside an imagine block are local to that blueprint and shadow globals of the same name.

define accent: "#ff6b35"

imagine badge
  define accent: "#72e37f"
  shape: rectangle
  fill: accent

create badge

The badge's local accent wins, so it's green, not orange.

Parametric Defines (Macros)

A define with parameters is a macro: a reusable block of motion. Its body can contain properties, animations, effects, and equality branches. Calls go inside an indented create block.

define fade_in(duration: 0.4s):
  animate opacity from 0 to 1 over duration

imagine card
  shape: rectangle

create card
  fade_in(0.6s)

Conditional Branches

Only if parameter == literal: is implemented. else, inequalities, and general conditions are not parser constructs inside parametric defines.

define enter(axis: "x"):
  if axis == "x":
    animate position.x from -100 to 0 over 0.4s
  if axis == "y":
    animate position.y from -100 to 0 over 0.4s

imagine card
  shape: rectangle

create card
  enter("x")

#baked "..." records the source preset on a parametric define. A trailing #disabled on a macro call keeps the call but stops it from expanding.