Add a drag-and-resize animation

A drawn pointer grabs the frame near its top edge, drags it across the
screen, lets go, then takes hold of one corner and pulls the frame to a
new size. Moves ease in and overshoot slightly before settling, and the
paths bow, so the motion reads as a hand rather than a tween.

The resize pins the opposite corner and keeps the aspect ratio locked —
a stretched video would read as broken, not as someone resizing — and
clamps the width to the room left before the corner leaves the screen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tg15tLAuT6NrCE1ZxKVgDB
This commit is contained in:
simon
2026-08-09 22:34:26 +02:00
co-authored by Claude Opus 5
parent 1afe6580ae
commit a6fd6e802a
5 changed files with 436 additions and 4 deletions
+7
View File
@@ -23,11 +23,18 @@ export const CORNER_INTERVAL_SECONDS = 5;
// Gap between the frame and the screen edge, as a fraction of the short side.
export const CORNER_MARGIN = 0.025;
// The drag animation resizes the frame to somewhere between these multiples of
// the normal frame size. Above 1 the frame grows past FRAME_SCALE, which is
// fine — nothing else is on screen while this animation runs.
export const DRAG_MIN_SCALE = 0.55;
export const DRAG_MAX_SCALE = 1.6;
// The frame animations, keyed by the id sent over the socket. The names must
// match the registry in public/player/motion.js, which supplies the code.
export const ANIMATIONS = {
bounce: { label: 'Bounce' },
corners: { label: 'Corners' },
drag: { label: 'Drag & resize' },
};
// Cycle a fresh random animation on every track change. Anything else pins the