Rig draw order properties
A rig layer's draw-order hold: the active draw-order state that permutes which artwork paints in front, or the artwork order when empty.
The rig draw order family: a rig layer's draw-order hold - the id of the active draw-order state ("" = the artwork order), a hold track over the rig's states. The active state permutes the comp's paint order for the layers it lists (the hit test walks the same order); a state that leaves the comp reads inert. The pattern reads, keyframes AND drives: a script picking a state per frame swaps which artwork is in front, which is the scripted head turn.
Every pattern below is readable from scripts through prop() and layer.prop(); ids in a pattern (like <effect_id>) stand for the entity's real id. Every pattern here is in the drive set: scripts may WRITE each one with set() or a single-output return, per frame.
| Pattern | Wire kind | Units | Reads | Writes |
|---|---|---|---|---|
rig.draw_order | enum | enum (the rig's draw-order state ids; "" = the artwork order; a hold track) | yes | drive set |
Worked examples
A rig layer's DRAW ORDER is a hold over its draw-order states (RIG-W4 POSE): rig.draw_order reads the id of the active state - or "" for the artwork order - and the active state permutes the comp's paint order for the layers it lists (the hit test walks the same order; a state that leaves the comp reads inert). The hold reads, keyframes AND drives - a script picking a state per frame swaps which artwork is in front, the scripted head turn.
Worked example: Swap the cards' order
The scene. A Stage comp with two overlapping cards - the Ace solid on the left and the King solid over its right half - and a Deck rig holding two draw-order states, Ace on top and King on top; the rig's draw-order hold rests empty, so the artwork order paints the King over the Ace.
- The comp Stage: 640 by 360 at 25 fps, 100 frames (4 seconds).
- Ace: a solid layer, at [260, 180], 160 by 100, filled e0a34d.
- King: a solid layer, at [380, 180], 160 by 100, filled 4d9de0.
- Deck: a rig layer.
- The draw-order states: Ace on top (
dos_1: King then Ace, the first painted first); King on top (dos_2: Ace then King, the first painted first); the hold empty (the artwork order).
- The draw-order states: Ace on top (
The script. Add a project script named Card swap and paste:
export const outputs = ["layer_3:rig.draw_order"];
export function frame() {
return time < 1 ? "dos_1" : "dos_2";
}
Line by line:
- Line 1: One output: the Deck rig's DRAW ORDER.
rig.draw_orderis a hold whose value is one of the rig's draw-order state ids (dos_1is Ace on top,dos_2King on top) or "" for the artwork order - the ids come from the scene (the Scripts panel and the@pick whip write them for you). - Line 4: For the first second the script returns
dos_1, so the Ace paints over the King where the two cards overlap; from one second on it returnsdos_2and the King paints over the Ace. A state names the FULL order of the layers it lists (first listed paints first), and the layers it does not list keep their places. The rig's own authored hold ("") is dormant while the script drives.
What you see. For the first second the Ace covers the King's left half; at one second the King jumps in front and covers the Ace's right half, and holds there - at frame 10 the draw order reads dos_1, at frame 40 dos_2.