---
name: spring-interactions
description: "Implement direct manipulation that preserves position and velocity. Use for spring, drag, physics."
---

# Пружинные взаимодействия

Implement direct manipulation that preserves position and velocity.

## Implementation decisions

1. Use pointer capture and handle pointercancel, with a keyboard alternative.
2. Use a damped spring for return motion; simple hover belongs in CSS.
3. Integrate with elapsed seconds and clamp delta after tab suspension.
4. Stop when settled, hidden or reduced motion is active.

## Working source

Read [components/demos.tsx](../webcraft-shared/source/components/demos.tsx) when implementing this capability. The example belongs to the WEBCRAFT React/Three.js playground except the Python commerce starter, which runs without third-party dependencies. Use [shared catalog](../webcraft-shared/source/lib/catalog.ts) only to resolve related examples. Adapt the source to the target framework and preserve existing project conventions.

## Verify observable behavior

- Leaving the target does not lose the gesture.
- New drag interrupts at the current position.
- Reduced motion returns instantly.

## Scope

Use only the parts relevant to the requested task. This skill does not grant permission to publish, spend money, change account access or expose secrets. The original brief and environment rules remain authoritative.

Live example: https://webcraft-skill-library.undrgrnd.chatgpt.site/demos/spring

Version 2.0.0 · Original WEBCRAFT content · MIT
