Variants
The same cord-pull markup stand-alone: sizes, colour preset and states.
Usage
Paste the markup, include assets/css/tokens.css and assets/css/tailwind.css, then call mount(el). Without a 3D world it animates its own bulb; pass a world and the bead rides the 3D cord.
Accessibility
- Role and state. The cord bead is a real <button role="switch"> with aria-checked. The 3D cord is decoration.
- Keyboard. Tab to the bead, Space or Enter pulls the cord. The focus ring uses the --ring token.
- Pointer and touch. Drag the cord down past the marker to switch; let go early and it springs back. A plain tap pulls it for you.
- Reduced motion. The lamp stops swinging and the light jumps to the end state; the room still renders as a still frame.
- Status is not colour-only. A live status line says "Light is on / off".
- Disabled. A disabled switch ignores pulls and stays dimmed.