fix(flashcards): use explicit per-property configs to fix decay physics
Removed conflicting top-level config that was interfering with decay animations. Now using explicit config objects for each property: - x, y: decay physics with velocity - scale, rotation: wobbly spring animations This should fix the issue where cards were snapping back to pickup position instead of staying where dropped. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
11aa44d882
commit
f32480a0f9
|
|
@ -213,6 +213,7 @@ function DraggableCard({ card }: DraggableCardProps) {
|
|||
// Calculate final rotation based on throw direction
|
||||
const throwAngle = Math.atan2(throwVelocityY, throwVelocityX) * (180 / Math.PI)
|
||||
|
||||
// Start position decay and rotation/scale animations
|
||||
api.start({
|
||||
x: {
|
||||
velocity: throwVelocityX,
|
||||
|
|
@ -222,9 +223,14 @@ function DraggableCard({ card }: DraggableCardProps) {
|
|||
velocity: throwVelocityY,
|
||||
config: { decay: true },
|
||||
},
|
||||
scale: 1,
|
||||
rotation: throwAngle + 90, // Card aligns with throw direction
|
||||
config: config.wobbly,
|
||||
scale: {
|
||||
value: 1,
|
||||
config: config.wobbly,
|
||||
},
|
||||
rotation: {
|
||||
value: throwAngle + 90, // Card aligns with throw direction
|
||||
config: config.wobbly,
|
||||
},
|
||||
onChange: (result) => {
|
||||
// Continue updating position as card settles with momentum
|
||||
if (result.value.x !== undefined) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue