File size: 4,175 Bytes
f68c02e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
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',
  },
})