Merged
Conversation
This commit implements a "rubber band" swipe-to-dismiss animation for the mini-player. When the user starts dragging the mini-player horizontally, it moves at a reduced speed (60% of the finger's movement) up to a threshold of 90dp. After the 90dp threshold is crossed, the mini-player follows the finger's movement directly. This creates a more interactive and polished feel, similar to the notification dismissal behavior in recent Android versions. The changes are implemented in `UnifiedPlayerSheet.kt` by modifying the `onHorizontalDrag` gesture handler.
This commit replaces the previous swipe animation with a more expressive, three-phase 'taut and snap' effect, as per user feedback. The new animation behaves as follows: 1. **Tension:** When the user starts dragging, the mini-player resists the movement significantly, moving to a maximum 'taut' offset of 60.dp as the user drags towards a 100.dp threshold. 2. **Snap:** Once the drag gesture crosses the threshold, a spring animation is triggered, causing the mini-player to 'snap' bouncily to the finger's current position. 3. **Free Drag:** After the snap, the mini-player follows the finger's movement 1-to-1 for the remainder of the gesture. This creates a more dynamic and polished user experience, closely mimicking modern Android notification dismissal animations. The implementation was refactored to use an `Animatable` for the horizontal offset, which allows for the complex state transitions between snapping, animating, and tracking the user's gesture.
This commit implements a highly polished, multi-stage swipe-to-dismiss animation for the mini-player, based on iterative user feedback. The final animation behaves as follows: 1. **Tension:** When the user starts dragging, the mini-player resists the movement significantly, creating a 'taut' rubber band effect. 2. **Snap & Follow:** Once the drag gesture crosses a threshold, the state transitions. The mini-player then smoothly animates towards the finger's position using a gentle spring. This creates a fluid 'snap' that continuously tracks the finger, providing a smooth and responsive feel without any visual jumps. This was achieved by: - Implementing a state machine (`DragPhase`) to manage the gesture's state. - Using `Animatable` to drive the offset and allow for smooth transitions. - Tuning the `spring` animation physics (`dampingRatio = 0.8f`, `stiffness = Spring.StiffnessLow`) to create a snap that is fast but not abrupt, as per the user's request.
This commit implements a highly polished, multi-stage swipe-to-dismiss animation for the mini-player, based on iterative user feedback. The final animation behaves as follows: 1. **Tension:** When the user starts dragging, the mini-player resists the movement significantly. It moves a maximum of 40.dp while the user drags 100.dp, creating a very noticeable 'taut' rubber band effect. 2. **Snap & Follow:** Once the drag gesture crosses the 100.dp threshold, the state transitions. The mini-player then smoothly animates towards the finger's position using a gentle spring. This creates a fluid 'snap' that continuously and smoothly tracks the finger's movement. This was achieved by: - Implementing a state machine (`DragPhase`) to manage the gesture's state (TENSION, SNAPPING_AND_TRACKING). - Using `Animatable` to drive the offset and allow for smooth, interruptible animations. - Tuning the `spring` animation physics (`dampingRatio = 0.8f`, `stiffness = Spring.StiffnessLow`) to create a snap that is fast but not abrupt. - Increasing the tension phase resistance by reducing the max travel distance to 40.dp.
This commit implements a highly polished, multi-stage swipe-to-dismiss animation for the mini-player, based on iterative user feedback. The final animation behaves as follows: 1. **Tension:** When the user starts dragging, the mini-player resists the movement significantly. It moves a maximum of 30.dp while the user drags 100.dp, creating a very noticeable 'taut' rubber band effect. 2. **Snap:** Once the drag gesture crosses the 100.dp threshold, a gentle spring animation is triggered, causing the mini-player to smoothly 'snap' to the finger's position at the time of the threshold crossing. 3. **Free Drag:** After the snap animation completes, the mini-player follows the finger's movement 1-to-1 for the rest of the gesture. This was achieved by: - Implementing a robust state machine (`DragPhase`) to manage the gesture's state (TENSION, SNAPPING, FREE_DRAG). - Using `Animatable` to drive the offset and allow for smooth, interruptible animations. - Tuning the `spring` animation physics (`dampingRatio = 0.8f`, `stiffness = Spring.StiffnessLow`) to create a snap that is fast but not abrupt. - Increasing the tension phase resistance by reducing the max travel distance to 30.dp. - Implementing a true 1-to-1 drag in the `FREE_DRAG` phase.
This commit implements a highly polished, multi-stage swipe-to-dismiss animation for the mini-player, based on iterative user feedback. This version perfects the logic to meet the user's final, detailed requirements. The final animation behaves as follows: 1. **Tension:** When the user starts dragging, the mini-player resists the movement significantly. It moves a maximum of 30.dp while the user drags 100.dp, creating a very noticeable 'taut' rubber band effect. 2. **Snap:** Once the drag gesture crosses the 100.dp threshold, a gentle spring animation is triggered. The animation is non-blocking to ensure the UI remains responsive. 3. **Free Drag:** After the snap animation completes, the logic transitions to a true 1-to-1 drag phase, where the mini-player follows the finger's movement exactly. This was achieved by: - Implementing a robust state machine (`DragPhase`) to manage the gesture's state (TENSION, SNAPPING, FREE_DRAG). - Using `Animatable` to drive the offset and allow for smooth, interruptible animations. - Tuning the `spring` animation physics (`dampingRatio = 0.8f`, `stiffness = Spring.StiffnessLow`) for a smooth snap. - Increasing the tension phase resistance (`maxTensionOffsetPx = 30.dp`). - Correcting the state transition logic to ensure a seamless and bug-free hand-off to the 1-to-1 `FREE_DRAG` phase after the snap.
This commit implements a highly polished, multi-stage swipe-to-dismiss animation for the mini-player, based on iterative user feedback. This version perfects the logic to meet all detailed requirements. The final animation behaves as follows: 1. **Tension:** When the user starts dragging, the mini-player resists the movement significantly. It moves a maximum of 30.dp while the user drags 100.dp, creating a very noticeable 'taut' rubber band effect. 2. **Snap & 1-to-1 Track:** Once the drag gesture crosses the threshold, the state transitions to a tracking mode. A high-stiffness spring animation is used to create an initial 'snap' and then seamlessly follow the finger with a 1-to-1 feel, resolving all previous issues with hitches or sluggishness. This was achieved by: - Implementing a robust two-phase state machine (`TENSION`, `SNAPPING_AND_TRACKING`) that never ignores drag input. - Using `Animatable` to drive the offset and allow for smooth, interruptible animations. - Tuning the tension phase resistance (`maxTensionOffsetPx = 30.dp`). - Using a `spring` with `StiffnessHigh` in the tracking phase to ensure the follow feels immediate and 1-to-1.
This commit implements a highly polished, multi-stage swipe-to-dismiss animation for the mini-player, based on iterative user feedback. This version perfects the logic to meet all detailed requirements. The final animation behaves as follows: 1. **Tension:** When the user starts dragging, the mini-player resists the movement significantly. It moves a maximum of 30.dp while the user drags 100.dp, creating a very noticeable 'taut' rubber band effect. 2. **Snap & 1-to-1 Track:** Once the drag gesture crosses the threshold, the state transitions to a tracking mode. A high-stiffness spring animation is used to create an initial 'snap' and then seamlessly follow the finger with a 1-to-1 feel. The return-to-center animation has also been polished to be faster and have a subtle bounce. This was achieved by: - Implementing a robust two-phase state machine (`TENSION`, `SNAPPING_AND_TRACKING`) that never ignores drag input. - Using `Animatable` to drive the offset and allow for smooth, interruptible animations. - Tuning the tension phase resistance (`maxTensionOffsetPx = 30.dp`). - Using a `spring` with `StiffnessHigh` in the tracking phase to ensure the follow feels immediate and 1-to-1. - Adjusting the `onDragEnd` return animation to use `DampingRatioMediumBouncy` for a more polished feel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.