Tune and interrupt a spring
Tune the response of one moving box, then change its target before it settles.
Before you start: Your first transition.
Every continuous transition defaults to spring. Start with presets: spring-fast responds quickly, spring-soft more gradually, and spring-bouncy adds deliberate oscillation.
Change the target while moving
The box changes only its horizontal translation. Press repeatedly while it moves: the spring keeps its current value and velocity.
<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'w-12 h-12 bg-accent transition-transform spring-soft ' + (changed ? 'translate-x-36' : 'translate-x-0')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Try it: Replace spring-soft with spring-bouncy, then spring-response-240 spring-damping-ratio-1.
Response is not duration
Response is the undamped period in milliseconds. Smaller values respond faster; settling time also depends on damping and momentum. A critically damped spring can pass a new target after reversal because it retains velocity. Do not describe critical damping as a guarantee that retargeting never overshoots.
Use spring reference for preset values, bounds, and advanced mass/stiffness/damping settings. Next: appearance.