Hi! First of all, great library! I'm using it in different projects.
Currently, when a sheet opens or closes, the backdrop uses its own independent animation that is out of sync with the sheet animation.
The backdrop has a fixed transition of duration: 1 while the sheet uses tweenConfig with a default duration: 0.2, this creates a noticeable desync.
Desired behavior
The sheet animation should control the backdrop animation.
- The backdrop opacity should be derived directly from the sheet's position (
y)
- On open: the backdrop should appear in sync with the sheet movement
- On close: the backdrop should fade out in sync with the sheet closing
- During drag: the backdrop opacity should follow the finger position in real time
Technical context
- Current backdrop: uses
initial/animate/exit with transition: { duration: 1 } independent animation
- Sheet: uses
y (MotionValue) to control position, the context already exposes y to children
- Proposed solution: use
useTransform to derive backdrop opacity from y, with the formula opacity = 1 - (y / closedY). This would require exposing closedY in the context.
Benefits
- Coherent and smooth animation
- Better user experience
- Backdrop automatically respects the sheet's
tweenConfig and prefersReducedMotion
- During drag, immediate and synced visual feedback
Hi! First of all, great library! I'm using it in different projects.
Currently, when a sheet opens or closes, the backdrop uses its own independent animation that is out of sync with the sheet animation.
The backdrop has a fixed transition of
duration: 1while the sheet usestweenConfigwith a defaultduration: 0.2, this creates a noticeable desync.Desired behavior
The sheet animation should control the backdrop animation.
y)Technical context
initial/animate/exitwithtransition: { duration: 1 }independent animationy(MotionValue) to control position, the context already exposesyto childrenuseTransformto derive backdrop opacity fromy, with the formulaopacity = 1 - (y / closedY). This would require exposingclosedYin the context.Benefits
tweenConfigandprefersReducedMotion