| import React, { useEffect, useRef } from 'react' |
| import { |
| View, Text, StyleSheet, Animated, Easing, Dimensions, |
| } from 'react-native' |
|
|
| const { height: SCREEN_H } = Dimensions.get('window') |
|
|
| const ACCENT = '#60a5fa' |
| const ACCENT_DIM = 'rgba(59,130,246,0.12)' |
| const ACCENT_BORDER = 'rgba(59,130,246,0.38)' |
|
|
| export default function SplashScreen({ onDone }) { |
| const scanAnim = useRef(new Animated.Value(0)).current |
| const progAnim = useRef(new Animated.Value(0)).current |
| const fadeAnim = useRef(new Animated.Value(1)).current |
|
|
| useEffect(() => { |
| Animated.loop( |
| Animated.timing(scanAnim, { |
| toValue: 1, |
| duration: 3200, |
| easing: Easing.linear, |
| useNativeDriver: true, |
| }) |
| ).start() |
|
|
| Animated.timing(progAnim, { |
| toValue: 1, |
| duration: 2600, |
| easing: Easing.out(Easing.quad), |
| useNativeDriver: false, |
| }).start() |
|
|
| const t = setTimeout(() => { |
| Animated.timing(fadeAnim, { |
| toValue: 0, |
| duration: 280, |
| useNativeDriver: true, |
| }).start(() => onDone && onDone()) |
| }, 2900) |
|
|
| return () => clearTimeout(t) |
| }, []) |
|
|
| const scanTranslate = scanAnim.interpolate({ |
| inputRange: [0, 1], |
| outputRange: [-2, SCREEN_H + 2], |
| }) |
|
|
| const progWidth = progAnim.interpolate({ |
| inputRange: [0, 1], |
| outputRange: ['0%', '100%'], |
| }) |
|
|
| return ( |
| <Animated.View style={[styles.root, { opacity: fadeAnim }]}> |
| {/* Orb glow */} |
| <View style={styles.orbTop} /> |
| <View style={styles.orbBottom} /> |
| |
| {/* Scan line */} |
| <Animated.View |
| style={[styles.scanLine, { transform: [{ translateY: scanTranslate }] }]} |
| /> |
| |
| {/* Content */} |
| <View style={styles.content}> |
| {/* Badge pill */} |
| <View style={styles.pill}> |
| <Text style={styles.pillText}>✎ LOCAL FILES · SYNTAX HIGHLIGHT</Text> |
| </View> |
| |
| {/* Title */} |
| <Text style={styles.title}>Code{'\n'}Editor</Text> |
| |
| {/* Subtitle */} |
| <Text style={styles.subtitle}> |
| Edit your local files with full syntax highlighting. |
| </Text> |
| |
| {/* Progress bar */} |
| <View style={styles.progWrap}> |
| <Animated.View style={[styles.progBar, { width: progWidth }]} /> |
| </View> |
| </View> |
| |
| {/* Version */} |
| <Text style={styles.version}>v1.0.0</Text> |
| </Animated.View> |
| ) |
| } |
|
|
| const styles = StyleSheet.create({ |
| root: { |
| flex: 1, |
| backgroundColor: '#08090f', |
| alignItems: 'center', |
| justifyContent: 'center', |
| }, |
| orbTop: { |
| position: 'absolute', |
| top: -80, |
| left: -60, |
| width: 380, |
| height: 380, |
| borderRadius: 190, |
| backgroundColor: 'rgba(37,99,235,0.13)', |
| }, |
| orbBottom: { |
| position: 'absolute', |
| bottom: -120, |
| right: -80, |
| width: 300, |
| height: 300, |
| borderRadius: 150, |
| backgroundColor: 'rgba(59,130,246,0.07)', |
| }, |
| scanLine: { |
| position: 'absolute', |
| left: 0, |
| right: 0, |
| top: 0, |
| height: 2, |
| backgroundColor: ACCENT, |
| opacity: 0.55, |
| }, |
| content: { |
| alignItems: 'center', |
| paddingHorizontal: 32, |
| zIndex: 10, |
| }, |
| pill: { |
| flexDirection: 'row', |
| alignItems: 'center', |
| paddingVertical: 5, |
| paddingHorizontal: 14, |
| borderRadius: 20, |
| borderWidth: 1, |
| borderColor: ACCENT_BORDER, |
| backgroundColor: ACCENT_DIM, |
| marginBottom: 20, |
| }, |
| pillText: { |
| color: '#93c5fd', |
| fontSize: 10, |
| fontWeight: '700', |
| letterSpacing: 1.1, |
| textTransform: 'uppercase', |
| }, |
| title: { |
| fontSize: 72, |
| fontWeight: '900', |
| color: '#bfdbfe', |
| textAlign: 'center', |
| lineHeight: 72, |
| letterSpacing: -2, |
| marginBottom: 12, |
| }, |
| subtitle: { |
| fontSize: 13, |
| color: '#4a5068', |
| textAlign: 'center', |
| letterSpacing: 0.3, |
| marginBottom: 32, |
| lineHeight: 19, |
| }, |
| progWrap: { |
| width: 180, |
| height: 2, |
| backgroundColor: 'rgba(255,255,255,0.06)', |
| borderRadius: 1, |
| overflow: 'hidden', |
| }, |
| progBar: { |
| height: '100%', |
| backgroundColor: ACCENT, |
| borderRadius: 1, |
| }, |
| version: { |
| position: 'absolute', |
| bottom: 20, |
| right: 20, |
| fontSize: 10, |
| color: '#252830', |
| }, |
| }) |
|
|