The **Sequence Node** (`SequenceNode`) creates, resamples, and structurally transforms numeric sequences (arrays up to 64 values) to drive multi-fixture tags, spatial gradients, and procedural chasers in Unilighter.

---

## 🔢 Overview & Sequence Architecture

In Unilighter Node Graphs, ordered numeric arrays are called **sequences**. A sequence can carry up to 64 normalized or raw numerical values. When routed into a tagged [Device Node](https://unilighter.cc/info/for-ai/docs/node-graphs/device.md), each element in the sequence maps directly to the corresponding fixture head in the tag.

Scalar inputs connected to sequence inputs are automatically treated as one-element sequences (`[value]`). Every operation provides two simultaneous outputs:
- **Sequence**: The calculated array of numbers (`number-array`).
- **Item**: A single scalar value extracted from the sequence using the cyclic **Item Index** input.

---

## 🛠️ Operations Reference

| Operation | Inputs | Behavior |
| :--- | :--- | :--- |
| **Manual** | `Item Index` | Stores an interactive, reorderable list of custom numerical values directly inside the graph. |
| **Fill** | `Value`, `Length`, `Item Index` | Fills an array of the specified `Length` with a constant scalar `Value`. |
| **Range** | `Start`, `End`, `Length`, `Item Index` | Generates evenly spaced numerical values from `Start` to `End`, inclusive. |
| **Concat** | `A`, `B`, `Item Index` | Joins two sequences (or scalars) `A` and `B` into a combined sequence. |
| **Reverse** | `Sequence`, `Item Index` | Inverts the sequence order from end to beginning. |
| **Rotate** | `Sequence`, `Offset`, `Item Index` | Cyclically rotates sequence elements. Positive offsets shift values to the right. |
| **Resize (Cycle)** | `Sequence`, `Length`, `Item Index` | Truncates or cyclically repeats values to match the target `Length`. Ideal for repeating fixture group patterns. |
| **Resample** | `Sequence`, `Length`, `Item Index` | Resizes the sequence using nearest-neighbor step sampling while preserving original endpoints. |
| **Interpolated Resample** | `Sequence`, `Length`, `Item Index` | Resizes the sequence using smooth linear interpolation while preserving original endpoints. Ideal for stretching short curves across arbitrary fixture counts. |
| **Mirror** | `Sequence`, `Item Index` | Creates a palindromic reflection without duplicating the center element (`[a, b, c]` becomes `[a, b, c, b, a]`). |
| **Seeded Shuffle** | `Sequence`, `Seed`, `Item Index` | Applies a deterministic Fisher-Yates shuffle. Identical input sequences and integer seeds always produce the exact same randomized ordering. |

---

## 💡 Lighting Design Workflows

### 1. Repeating Modular Fixture Patterns
When controlling a 24-fixture truss line using a 4-step intensity wave, wire the 4-step sequence into `SequenceNode` set to **Resize (Cycle)** with `Length = 24`. The 4-step pattern automatically tiles cyclically across all 24 lights.

### 2. Smooth Spatial Gradient Expansion
When designing an asymmetric tilt curve with 5 reference points, wire it into `SequenceNode` set to **Interpolated Resample** with `Length` matched to your tag's fixture count (e.g. 16 moving heads). The 5-point curve stretches into a smooth 16-point spatial arc without stair-stepping.

### 3. Extracting Single Fixture Taps
Use the **Item Index** socket to extract individual values from a moving sequence. Because the index wraps cyclically (`index % length`), driving it with a master fader or LFO creates continuous rotary selection across your rig.

---

## 🔌 Sockets Reference

| Socket | Direction | Data Type | Description |
| :--- | :--- | :--- | :--- |
| **Sequence** | Input / Output | `Sequence` | Primary input sequence / calculated output array. |
| **A / B** | Input | `Sequence` | Operand sequences for concatenation. |
| **Length** | Input | `Number` | Output length (integer `0 – 64`). |
| **Offset** | Input | `Number` | Cyclic rotation shift distance (signed integer). |
| **Seed** | Input | `Number` | Random seed for deterministic shuffle. |
| **Item Index** | Input | `Number` | Cyclic index selector for single-item extraction. |
| **Item** | Output | `Number` | Scalar value at the selected `Item Index`. |

