GCBGutenberg
Control Blocks
Buy

Field type

layers

A card of one shape with things laid over each other on it, each at its own place and its own depth: a product card with its name, a photo and a badge standing off it. Flat, it is a card with things placed on it; turned in 3D (the triggers script's tilt), the nearer layers slide against the further ones.

Type: layers · Stored attribute type: object

Stored value

object — { shape: 16/9|4/3|1/1|4/5|9/14, layers: [{ at: [across, down], w, depth }] }; at is the layer's middle and w its width, as shares of the card (0 to 1); depth 0 (lying on the card) to 10 (nearest)

Supports

  • Up to 12 layers, each placed by its middle and its width; its height is its content's.
  • A depth for each layer: how far it stands off the card toward the person looking.
  • A short written form, shown in the field and accepted there: shape 9/14; layer 0.5,0.12 0.6 2; layer 0.5,0.38 0.48 4; layer 0.5,0.9 0.1 4 (middle, width, depth; depth 0 when not said).
  • Checked as written — the field says what is wrong as sentences, and a value with anything wrong in it places nothing.

Gotchas

  • The layers are the block's children in order: the first child is the first layer. Keep as many children as layers.
  • A layer is placed by its MIDDLE, not its top left: 0.5,0.5 is the middle of the card.
  • In render.php place them with \GCBLite\Contract\LayersValue::css( $value, $layerSelector ): it writes each layer's left, top, width and --gcb-depth; the stylesheet turns the depth into how far it stands off (translateZ).

Example

JSON
{ "id": "ctrl_layers",
  "type": "layers",
  "label": "Layers",
  "attributeKey": "layers",
  "start": { "shape": "4/5", "layers": [ { "at": [0.5, 0.2], "w": 0.7, "depth": 2 }, { "at": [0.5, 0.6], "w": 0.5, "depth": 5 } ] } }

The layers field

The field shows the card as a small picture with each layer numbered where it sits (nearer ones darker), a row for each layer to set its place, width and depth, and the written short form to fine-tune. gcb/tilt (the Tilt block) is the block that uses it.

Every field also takes the keys common to all fields.

Built from GCB Lite 0.4.0 (ce232d4). Source: schemas/controls/layers.md.

Copyright © 2026 Runchain. WordPress is a trademark of the WordPress Foundation.