From b4aab3e74b1830ce2aa916db2b7063b7ef376a0e Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Thu, 14 Dec 2023 23:23:00 +0530 Subject: [PATCH] tweak --- src/Splash.tsx | 19 ++++++++++++++++--- src/view/icons/Logo.tsx | 14 ++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/Splash.tsx b/src/Splash.tsx index 57c5c83154..6a07fb81b9 100644 --- a/src/Splash.tsx +++ b/src/Splash.tsx @@ -19,6 +19,8 @@ type Props = { SplashScreen.preventAutoHideAsync().catch(() => {}) +const AnimatedLogo = Animated.createAnimatedComponent(Logo) + export function Splash(props: React.PropsWithChildren) { const fadeAnimationProgress = useSharedValue(0) const scaleAnimationProgress = useSharedValue(0) @@ -26,6 +28,18 @@ export function Splash(props: React.PropsWithChildren) { const logoScaleAnimation = useAnimatedStyle(() => { return { + width: interpolate( + scaleAnimationProgress.value, + [0, 0.2, 0.22, 1], + [100, 100, 1000, 1000], + 'clamp', + ), + height: interpolate( + scaleAnimationProgress.value, + [0, 0.2, 0.22, 1], + [100, 100, 1000, 1000], + 'clamp', + ), transform: [ { scale: interpolate( @@ -89,7 +103,7 @@ export function Splash(props: React.PropsWithChildren) { () => { scaleAnimationProgress.value = withTiming( 1, - {duration: 1000, easing: Easing.inOut(Easing.cubic)}, + {duration: 1200, easing: Easing.inOut(Easing.cubic)}, () => { runOnJS(onFinish)() }, @@ -120,10 +134,9 @@ export function Splash(props: React.PropsWithChildren) { justifyContent: 'center', alignItems: 'center', }, - logoScaleAnimation, logoFadeInAnimation, ]}> - + }> {!isAnimationComplete && ( diff --git a/src/view/icons/Logo.tsx b/src/view/icons/Logo.tsx index 5d78a2adc7..4e36da46cd 100644 --- a/src/view/icons/Logo.tsx +++ b/src/view/icons/Logo.tsx @@ -12,7 +12,12 @@ import {colors} from '#/lib/styles' const ratio = 106 / 120 -export function Logo({fill, ...rest}: {fill?: PathProps['fill']} & SvgProps) { +type Props = { + fill?: PathProps['fill'] +} & SvgProps + +export const Logo = React.forwardRef(function LogoImpl(props: Props, ref) { + const {fill, ...rest} = props const gradient = fill === 'sky' const _fill = gradient ? 'url(#sky)' : fill || colors.blue3 // @ts-ignore it's fiiiiine @@ -20,10 +25,11 @@ export function Logo({fill, ...rest}: {fill?: PathProps['fill']} & SvgProps) { return ( + style={{width: size, height: size * ratio}}> {gradient && ( @@ -39,4 +45,4 @@ export function Logo({fill, ...rest}: {fill?: PathProps['fill']} & SvgProps) { /> ) -} +})