Bluesky app fork with some witchin' additions 💫

feat: Tweak shared element animation to make it much smoother (#6336)

authored by

Marc Rousavy and committed by
GitHub
05312cce 7d34f6bb

+15 -4
+15 -4
src/view/com/lightbox/ImageViewing/index.tsx
··· 32 32 useSharedValue, 33 33 withDecay, 34 34 withSpring, 35 + WithSpringConfig, 35 36 } from 'react-native-reanimated' 36 37 import { 37 38 Edge, ··· 62 63 ? (['top', 'bottom', 'left', 'right'] satisfies Edge[]) 63 64 : (['left', 'right'] satisfies Edge[]) // iOS, so no top/bottom safe area 64 65 65 - const SLOW_SPRING = {stiffness: isIOS ? 180 : 250} 66 - const FAST_SPRING = {stiffness: 700} 66 + const SLOW_SPRING: WithSpringConfig = { 67 + mass: isIOS ? 1.5 : 1, 68 + damping: 300, 69 + stiffness: 800, 70 + restDisplacementThreshold: 0.01, 71 + } 72 + const FAST_SPRING: WithSpringConfig = { 73 + mass: isIOS ? 1.5 : 1, 74 + damping: 150, 75 + stiffness: 900, 76 + restDisplacementThreshold: 0.01, 77 + } 67 78 68 79 export default function ImageViewRoot({ 69 80 lightbox: nextLightbox, ··· 706 717 } 707 718 } 708 719 709 - function withClampedSpring(value: any, {stiffness}: {stiffness: number}) { 720 + function withClampedSpring(value: any, config: WithSpringConfig) { 710 721 'worklet' 711 - return withSpring(value, {overshootClamping: true, stiffness}) 722 + return withSpring(value, {...config, overshootClamping: true}) 712 723 }