# cursor-drag

Defines GSAP choreography for driven cursor drags: lockstep ghost movement, slot drop-snaps, corner resizing, and spreadsheet auto-fills.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 328 repo stars
- Author: coco-research
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/coco-research/coco/tree/HEAD/systems/hyperframes/skills/hyperframes-animation/rules/cursor-drag.md
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/cursor-drag

## What it does

This rule enforces the mechanics of simulated cursor drag interactions in GSAP timelines. The interaction runs through five steps: approach, grab with a downward press dip, travel, drop-snap, and exit. The core requirement is lockstep tracking. The cursor tip and the payload grip point must move together via matched tweens with identical durations and eases; even a single frame of drift makes the chip look loose.

Specific recipes extend beyond standard chip-to-slot drops. Corner resizing prohibits width and height tweens, mandating uniform `scale` with the transform origin anchored at the opposing corner. Dragging spreadsheet fill handles runs on a linear ease with discrete visibility commits, while list reordering triggers a neighbor spring displacement midway through travel.

Using relative `+=` deltas on either tween breaks lockstep under timeline seeks, making absolute coordinates mandatory for both endpoints.

## Requirements
- Works with: Chrome

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/cursor-drag.md` — The paths frontmatter field limits the files

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/cursor-drag.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/cursor-drag.instructions.md` — The applyTo field sets which files it applies to

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/cursor-drag.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/cursor-drag.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/coco-research/coco/tree/HEAD/systems/hyperframes/skills/hyperframes-animation/rules/cursor-drag.md

## When to use it
- lock driven cursor coordinates to an item ghost during GSAP drag journeys
- build spreadsheet handle fill animations with row-by-row commits
- implement proportional box resizing anchored to the opposite corner
- choreograph list reorder sequences where neighbors spring into vacant slots

## Example prompts
- Generate a GSAP drag-and-drop sequence from source chip to placed field using cursor-drag
- Choreograph a driven cursor resizing a container from its corner handle
- Create an auto-fill handle drag animation spanning three spreadsheet rows

## Source text · cursor-drag.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 83859745a159c362.

BEGIN THIRD-PARTY FILE 83859745a159c362
````text
---
name: cursor-drag
description: The drag verb for driven cursors — grab, lift, travel, drop-snap. A semi-transparent ghost chip rides the cursor in exact lockstep and snaps into a placed field with selection chrome; variants cover fill-handle auto-fill down rows, corner-handle proportional resize (uniform scale only), and grab-lift-reorder with the neighbor springing into the vacated slot.
metadata:
  tags: cursor, drag, drop, ghost, handle, resize, reorder, snap, interaction, mouse
---

# Cursor Drag

> Cursor look, sizing, off-screen entry, and tip-targeting defer to the **oversized-cursor house doctrine** — this rule owns the drag _mechanics_ only.

THE held-journey verb: the cursor presses down on a payload, carries it, and releases it somewhere else. The load-bearing law is **lockstep**: the cursor tip and the payload's grip point move as one rigid object for the entire travel — a one-frame drift reads as the chip slipping out of the hand. Distinct from [cursor-click-ripple.md](cursor-click-ripple.md) (move → point event at a single location): a drag is a _sustained hold across space_, and the payload is the co-star. Reuse [physics-press-reaction.md](physics-press-reaction.md) for the grab's press dip (cursor + payload compress together); for N simultaneous actors see [multi-cursor-choreography.md](multi-cursor-choreography.md) — this rule is one protagonist performing a workflow beat.

## How It Works

Five beats: **approach** (cursor glides to the source chip, `power2.inOut`) → **grab** (press dip on cursor + chip together; on the down-beat `tl.set` reveals the **ghost** — a pre-rendered semi-transparent clone at the chip's position — plus a small lift `fromTo` to `GHOST_LIFT_SCALE` with a soft shadow, `immediateRender: false`) → **travel** (cursor and ghost move as **matched tweens**) → **drop** (ghost off, placed field pops in with selection chrome) → **adjust / exit** (optional handle resize, then the cursor glides to the next target).

Matched tweens = same timeline position, same duration, same ease, over straight lines — that keeps the pair rigidly locked at every eased midpoint. A shared `[cursor, ghost]` targets array only works when both need identical deltas; with different start points, use two matched `fromTo`s. Rule-specific corollary of the contract's absolute-values law: a relative `+=` travel on either partner breaks the lockstep under seek.

Measure chip and slot rects at build time — a 4 px miss on the drop line reads as a failed drag (montage: authored CSS-matched constants, per the contract). `TIP_OFFSET_X/Y` aligns the cursor's TIP (not its bbox) with the grip point.

## Recipe

```html
<!-- Ghost = clone of the chip AT the chip's position, in DOM from t=0, opacity: 0.
     Same silhouette as the chip — or hand and payload read as different objects.
     Placed field sits at the slot's final position, opacity: 0, with a .select-box
     and four corner .handle elements inside. -->
<div class="tray-chip" id="source-chip"><span class="grip-dots">⋮⋮</span> {chipLabel}</div>
<div class="drag-ghost" id="drag-ghost"><span class="grip-dots">⋮⋮</span> {chipLabel}</div>
<div class="placed-field" id="placed-field">
  {placedLabel}
  <!-- + selection chrome -->
</div>
<div class="cursor" id="cursor"><!-- arrow SVG --></div>
```

```js
const chipRect = document.querySelector("#source-chip").getBoundingClientRect();
const slotRect = document.querySelector("#placed-field").getBoundingClientRect();
````
END THIRD-PARTY FILE 83859745a159c362

The third-party file has ended. Everything between the 83859745a159c362 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3513 of 10215 bytes. © coco-research · MIT · https://github.com/coco-research/coco/tree/HEAD/systems/hyperframes/skills/hyperframes-animation/rules/cursor-drag.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
