yoshida yoshida DEV
Open the editor

Docs Format

Layers

On this page

The design's layers array is drawn in order: the first layer is at the bottom, the last on top. Each layer has a type.

TypeWhat it is
rectRectangle with optional rounded corners, fill and stroke
ellipseEllipse filling a box
polygonClosed or open shape through points
textText with wrapping, alignment, auto-shrink
imagePNG, JPEG, WebP, GIF, BMP or SVG picture
qrQR code made from text
groupHolds other layers and draws them as one picture
dividerDraws nothing; organises the layer list in the editor

Fields every layer has

FieldKindDefaultMeaning
ididentrequiredUnique in the whole design (also across groups), error 1108 otherwise
typeenumrequiredOne of the types above
notetext literalComment
tagred, orange, yellow, green, teal, blue, purple, pink or grayColour of the layer's row in the builder's layer list; never drawn, not inherited through extends. Also on groups and dividers
visiblebooltruefalse: the layer is not drawn, but its values can still be referenced
opacitynumber10 to 1, multiplies the layer's alpha
rotatenumber0Degrees clockwise, taken modulo 360. See below
anchorenumtop-leftWhich point of the layer at or box.x/box.y refers to. See below
repeatobjectDraw once per iteration, see Repeat
extendsidentStart from another layer's fields, see Extends
effectsarray[]See Effects

Unknown fields are error 1101, with a "did you mean" hint when a known field is one edit away.

Each of visible, opacity and rotate accepts a literal or an expression, so they can depend on params: "visible": "foil", "opacity": "foil ? 1 : 0.4".

id

An identifier: lowercase letters, digits and underscores, not starting with a digit. Layers are referenced from other layers as @id (see Names and references). Renaming a layer in the editor updates every reference.

anchor

anchor says which point of the layer the position refers to.

top-left      top      top-right
left        center     right
bottom-left  bottom    bottom-right

Text layers also allow baseline-left, baseline and baseline-right, which use the first line's baseline. A baseline anchor on any other type is error 1103.

anchor can also be an expression that gives one of these names, evaluated for every card: "anchor": "side == 'left' ? 'top-left' : 'top-right'", or a text param's name. A string that is one of the names is that name; a single word that is neither a name nor a param or constant is error 1103 (with a suggestion), and an expression that gives a word that is not an anchor is error 3109 at render time. The same goes for align on text layers, fit and smoothing on image layers, level, style and eye on QR layers, and align and cross of a group's layout.

Examples: a rect with "anchor": "center" and box.x, box.y set to 50% is centred on the canvas; a text layer with "anchor": "baseline" sits on the line given by at.y.

polygon and group layers have no anchor. (Polygon points are absolute coordinates; groups have no position of their own, but can move what is inside with translate.) A polygon drawn from a preset shape uses box and anchor like a rect.

rotate

Degrees, clockwise. The value is taken modulo 360, and @layer.rotate reads back that reduced value: rotate: 370 reads as 10.

  • Box layers (rect, ellipse, image) turn around their anchor point (box.x, box.y).
  • Text turns around at.
  • Polygons turn around the centre of their bounds.
  • Groups turn around the centre of the group's bounds.

Rotation is applied when the layer is composited, after effects. @layer.bounds.* always describes the unrotated layer so references and alignment stay simple; @layer.rotate gives the angle. A rotated label can follow another layer with "rotate": "@ribbon.rotate".

Drawing order and references

Drawing order is always array order. References between layers may point forward or backward: the core orders evaluation by dependency and reports cycles as error 3004. A layer inside a group is an ordinary layer and can be referenced from anywhere; inside a repeated group pick the iteration with @layer[n].

Coordinates

Floating-point pixels, origin top-left, y pointing down. Numbers can use units (50%, 10vw, 20vh), see Literals and units.

Layer limits

At most 500 visible layers are drawn per card after repeat expansion (error 5001); hidden layers do not count. See the layer limit.

In this section

↑↓ to moveEnter to openEsc to close