Skip to content

RingLayout

RingLayout is a Layout module that places N physical LEDs in a circle on a square virtual grid. It is the reference non-rectangular fixture: physical LEDs occupy only the ring-shaped cells of the virtual canvas; all other cells default to black (no physical LED).

Purpose

A ring of LEDs — LED strip wrapped around a circle — is one of the most common non-rectangular fixtures. With RingLayout any 2D effect (sine wave, noise, lines) renders across the full virtual grid and the ring LEDs display only the pixels at their angular positions, creating natural circular motion, colour sweeps, and radial animations without any changes to the effect code.

Controls

Key UI type Min Max Default Description
ledCount slider 3 512 60 Number of physical LEDs in the ring
radius slider 1 255 30 Ring radius in virtual pixels

Wiring

Add as a child of a DriverLayer:

{ "type": "RingLayout", "id": "ring1", "parent_id": "driver1",
  "props": { "ledCount": 241, "radius": 38 } }

Behaviour

  • Virtual grid: (2*radius+1) x (2*radius+1) x 1. A 241-LED ring with radius=38 uses a 77 x 77 virtual canvas.
  • Physical mapping: physical LED i maps to the nearest integer virtual cell at (cx + round(radius * cos(i * 2pi / ledCount)), cy + round(radius * sin(i * 2pi / ledCount)), 0).
  • Sparse canvas: most virtual cells have no physical LED. The preview skips black cells, so the WebGL point cloud renders as a ring shape.
  • Collision: when ledCount is high relative to radius, multiple LEDs may map to the same virtual cell. Both drive the same effect pixel independently.
  • onUpdate: any control change triggers onChildrenReady() on the parent DriverLayer to rebuild the PhysMap.

Test coverage

See Non-Rectangular Layouts — extent dimensions, physCount, LED 0 at angle 0, unique virtual-cell distribution.

Source