@adminide-stack/clock-tik-mobile 0.0.0-stage → 12.0.37-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/.claude-flow/data/pending-insights.jsonl +43 -0
  2. package/.claude-flow/sessions/session-1794323376548.json +14 -0
  3. package/CHANGELOG.md +41 -0
  4. package/jest.config.cjs +22 -0
  5. package/lib/assets/home/loop-day.jpg +0 -0
  6. package/lib/assets/home/loop-day.mp4 +0 -0
  7. package/lib/assets/home/loop-time-back.jpg +0 -0
  8. package/lib/assets/home/loop-time-back.mp4 +0 -0
  9. package/lib/assets/home/loop-where.jpg +0 -0
  10. package/lib/assets/home/loop-where.mp4 +0 -0
  11. package/lib/assets/home/reel-gym.jpg +0 -0
  12. package/lib/assets/home/reel-gym.mp4 +0 -0
  13. package/lib/assets/home/reel-internet.jpg +0 -0
  14. package/lib/assets/home/reel-internet.mp4 +0 -0
  15. package/lib/assets/icon.png +0 -0
  16. package/lib/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
  17. package/lib/assets/lottie/lucy-mark-calendar.json +1827 -0
  18. package/lib/assets/lottie/lucy-mark-call.json +1470 -0
  19. package/lib/assets/lottie/lucy-mark-connect.json +2552 -0
  20. package/lib/assets/lottie/lucy-mark-details.json +1735 -0
  21. package/lib/assets/lottie/lucy-mark-email.json +1363 -0
  22. package/lib/assets/lottie/lucy-mark-message.json +1154 -0
  23. package/lib/assets/lottie/lucy-mark-search.json +1067 -0
  24. package/lib/assets/lottie/lucy-mark-think.json +1253 -0
  25. package/lib/assets/lottie/lucy-mark-write.json +1532 -0
  26. package/lib/assets/lottie/time-back.json +16458 -0
  27. package/lib/assets/lottie/where-lucy-works-chat.json +6170 -0
  28. package/lib/assets/lottie/where-lucy-works-cloud.json +10066 -0
  29. package/lib/assets/lottie/where-lucy-works-mine-none.json +2478 -0
  30. package/lib/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
  31. package/lib/assets/lottie/where-lucy-works-mine-online.json +7881 -0
  32. package/lib/assets/sounds/hours-back.m4a +0 -0
  33. package/lib/assets/sounds/meet-lucy.m4a +0 -0
  34. package/lib/assets/sounds/power-on.m4a +0 -0
  35. package/lib/assets/sounds/wind-back.m4a +0 -0
  36. package/lib/assets/sounds/youre-in.m4a +0 -0
  37. package/lib/chat/agent.js +358 -0
  38. package/lib/chat/agent.js.map +1 -0
  39. package/lib/chat/appFront.js +32 -0
  40. package/lib/chat/appFront.js.map +1 -0
  41. package/lib/chat/auth.js +370 -0
  42. package/lib/chat/auth.js.map +1 -0
  43. package/lib/chat/chores.js +360 -0
  44. package/lib/chat/chores.js.map +1 -0
  45. package/lib/chat/connectors.js +45 -0
  46. package/lib/chat/connectors.js.map +1 -0
  47. package/lib/chat/jobs.js +223 -0
  48. package/lib/chat/jobs.js.map +1 -0
  49. package/lib/chat/lucyMotion.js +6 -0
  50. package/lib/chat/lucyMotion.js.map +1 -0
  51. package/lib/chat/protocol.js +111 -0
  52. package/lib/chat/protocol.js.map +1 -0
  53. package/lib/chat/results.js +133 -0
  54. package/lib/chat/results.js.map +1 -0
  55. package/lib/chat/store.js +81 -0
  56. package/lib/chat/store.js.map +1 -0
  57. package/lib/chat/useDictation.js +168 -0
  58. package/lib/chat/useDictation.js.map +1 -0
  59. package/lib/chat/useLucyChat.js +451 -0
  60. package/lib/chat/useLucyChat.js.map +1 -0
  61. package/lib/chat/useMyComputer.js +32 -0
  62. package/lib/chat/useMyComputer.js.map +1 -0
  63. package/lib/chat/whereLucyWorks.js +52 -0
  64. package/lib/chat/whereLucyWorks.js.map +1 -0
  65. package/lib/chat/workspace.js +124 -0
  66. package/lib/chat/workspace.js.map +1 -0
  67. package/lib/components/AreaShot.js +289 -0
  68. package/lib/components/AreaShot.js.map +1 -0
  69. package/lib/components/Backdrops.js +262 -0
  70. package/lib/components/Backdrops.js.map +1 -0
  71. package/lib/components/BottomSheet.js +61 -0
  72. package/lib/components/BottomSheet.js.map +1 -0
  73. package/lib/components/ChatSheets.js +429 -0
  74. package/lib/components/ChatSheets.js.map +1 -0
  75. package/lib/components/ConnectorLogo.js +91 -0
  76. package/lib/components/ConnectorLogo.js.map +1 -0
  77. package/lib/components/CustomDrawer.js +534 -0
  78. package/lib/components/CustomDrawer.js.map +1 -0
  79. package/lib/components/IdeasPane.js +394 -0
  80. package/lib/components/IdeasPane.js.map +1 -0
  81. package/lib/components/ImessageSheet.js +261 -0
  82. package/lib/components/ImessageSheet.js.map +1 -0
  83. package/lib/components/KeyboardAvoider.js +29 -0
  84. package/lib/components/KeyboardAvoider.js.map +1 -0
  85. package/lib/components/Logo.js +81 -0
  86. package/lib/components/Logo.js.map +1 -0
  87. package/lib/components/LucyWorking.js +67 -0
  88. package/lib/components/LucyWorking.js.map +1 -0
  89. package/lib/components/Markdown.js +260 -0
  90. package/lib/components/Markdown.js.map +1 -0
  91. package/lib/components/Media.js +93 -0
  92. package/lib/components/Media.js.map +1 -0
  93. package/lib/components/MessagesAppIcon.js +23 -0
  94. package/lib/components/MessagesAppIcon.js.map +1 -0
  95. package/lib/components/MicButton.js +71 -0
  96. package/lib/components/MicButton.js.map +1 -0
  97. package/lib/components/ResultCards.js +974 -0
  98. package/lib/components/ResultCards.js.map +1 -0
  99. package/lib/components/SignInPrompt.js +148 -0
  100. package/lib/components/SignInPrompt.js.map +1 -0
  101. package/lib/components/SignedOut.js +38 -0
  102. package/lib/components/SignedOut.js.map +1 -0
  103. package/lib/components/TalkToLucyHero.js +487 -0
  104. package/lib/components/TalkToLucyHero.js.map +1 -0
  105. package/lib/components/TalkToLucySheet.js +182 -0
  106. package/lib/components/TalkToLucySheet.js.map +1 -0
  107. package/lib/components/WhereLucyWorks.js +277 -0
  108. package/lib/components/WhereLucyWorks.js.map +1 -0
  109. package/lib/components/WorkspaceSection.js +271 -0
  110. package/lib/components/WorkspaceSection.js.map +1 -0
  111. package/lib/components/YantraMark.js +13 -0
  112. package/lib/components/YantraMark.js.map +1 -0
  113. package/lib/components/drawerHeader.js +38 -0
  114. package/lib/components/drawerHeader.js.map +1 -0
  115. package/lib/components/lottieInstalled.js +6 -0
  116. package/lib/components/lottieInstalled.js.map +1 -0
  117. package/lib/components/ui.js +550 -0
  118. package/lib/components/ui.js.map +1 -0
  119. package/lib/components/useSignOut.js +7 -0
  120. package/lib/components/useSignOut.js.map +1 -0
  121. package/lib/components/viewport.js +121 -0
  122. package/lib/components/viewport.js.map +1 -0
  123. package/lib/components/voiceDial.js +10 -0
  124. package/lib/components/voiceDial.js.map +1 -0
  125. package/lib/compute.js +157 -0
  126. package/lib/compute.js.map +1 -0
  127. package/lib/config/env-config.js +27 -0
  128. package/lib/config/env-config.js.map +1 -0
  129. package/lib/config/routes.js +15 -0
  130. package/lib/config/routes.js.map +1 -0
  131. package/lib/content.js +25 -0
  132. package/lib/content.js.map +1 -0
  133. package/lib/hooks/keyboardCover.js +39 -0
  134. package/lib/hooks/keyboardCover.js.map +1 -0
  135. package/lib/hooks/useKeyboard.js +121 -0
  136. package/lib/hooks/useKeyboard.js.map +1 -0
  137. package/lib/hooks/useReducedMotion.js +13 -0
  138. package/lib/hooks/useReducedMotion.js.map +1 -0
  139. package/lib/imessage/openMessages.js +25 -0
  140. package/lib/imessage/openMessages.js.map +1 -0
  141. package/lib/imessage/platform.js +12 -0
  142. package/lib/imessage/platform.js.map +1 -0
  143. package/lib/imessage/textLink.js +262 -0
  144. package/lib/imessage/textLink.js.map +1 -0
  145. package/lib/index.js +1 -0
  146. package/lib/index.js.map +1 -0
  147. package/lib/live/card.js +28 -0
  148. package/lib/live/card.js.map +1 -0
  149. package/lib/live/liveActivity.js +144 -0
  150. package/lib/live/liveActivity.js.map +1 -0
  151. package/lib/module.js +3 -0
  152. package/lib/module.js.map +1 -0
  153. package/lib/offer/BlackFridayOffer.js +378 -0
  154. package/lib/offer/BlackFridayOffer.js.map +1 -0
  155. package/lib/offer/blackFriday.js +78 -0
  156. package/lib/offer/blackFriday.js.map +1 -0
  157. package/lib/offer/parts.js +624 -0
  158. package/lib/offer/parts.js.map +1 -0
  159. package/lib/offer/state.js +63 -0
  160. package/lib/offer/state.js.map +1 -0
  161. package/lib/push/push.js +142 -0
  162. package/lib/push/push.js.map +1 -0
  163. package/lib/push/usePushNotifications.js +39 -0
  164. package/lib/push/usePushNotifications.js.map +1 -0
  165. package/lib/routes.json +175 -0
  166. package/lib/screens/Account/index.js +209 -0
  167. package/lib/screens/Account/index.js.map +1 -0
  168. package/lib/screens/Chat/index.js +710 -0
  169. package/lib/screens/Chat/index.js.map +1 -0
  170. package/lib/screens/Chores/index.js +18 -0
  171. package/lib/screens/Chores/index.js.map +1 -0
  172. package/lib/screens/Connectors/index.js +17 -0
  173. package/lib/screens/Connectors/index.js.map +1 -0
  174. package/lib/screens/History/index.js +380 -0
  175. package/lib/screens/History/index.js.map +1 -0
  176. package/lib/screens/Home/index.js +2715 -0
  177. package/lib/screens/Home/index.js.map +1 -0
  178. package/lib/screens/Home/media.js +25 -0
  179. package/lib/screens/Home/media.js.map +1 -0
  180. package/lib/screens/Welcome/index.js +1066 -0
  181. package/lib/screens/Welcome/index.js.map +1 -0
  182. package/lib/talk/talkToLucy.js +139 -0
  183. package/lib/talk/talkToLucy.js.map +1 -0
  184. package/lib/theme/colors.js +29 -0
  185. package/lib/theme/colors.js.map +1 -0
  186. package/lib/theme/fonts.js +17 -0
  187. package/lib/theme/fonts.js.map +1 -0
  188. package/lib/theme/muse.js +134 -0
  189. package/lib/theme/muse.js.map +1 -0
  190. package/lib/utils/links.js +54 -0
  191. package/lib/utils/links.js.map +1 -0
  192. package/lib/utils/yantraLinks.js +68 -0
  193. package/lib/utils/yantraLinks.js.map +1 -0
  194. package/lib/welcome/flow.js +375 -0
  195. package/lib/welcome/flow.js.map +1 -0
  196. package/lib/welcome/haptics.js +125 -0
  197. package/lib/welcome/haptics.js.map +1 -0
  198. package/lib/welcome/parts.js +1996 -0
  199. package/lib/welcome/parts.js.map +1 -0
  200. package/lib/welcome/powerOn.js +29 -0
  201. package/lib/welcome/powerOn.js.map +1 -0
  202. package/lib/welcome/seen.js +41 -0
  203. package/lib/welcome/seen.js.map +1 -0
  204. package/lib/welcome/sound.js +110 -0
  205. package/lib/welcome/sound.js.map +1 -0
  206. package/package.json +66 -5
  207. package/rollup.config.mjs +42 -0
  208. package/src/.claude-flow/data/pending-insights.jsonl +19 -0
  209. package/src/.claude-flow/sessions/session-1795013028422.json +14 -0
  210. package/src/__tests__/auth.test.ts +94 -0
  211. package/src/__tests__/blackFriday.test.ts +75 -0
  212. package/src/__tests__/cardTokens.test.ts +77 -0
  213. package/src/__tests__/chores.test.ts +188 -0
  214. package/src/__tests__/choresList.test.ts +100 -0
  215. package/src/__tests__/connectLink.test.ts +21 -0
  216. package/src/__tests__/content.test.ts +54 -0
  217. package/src/__tests__/dictation.test.ts +186 -0
  218. package/src/__tests__/envConfig.test.ts +14 -0
  219. package/src/__tests__/haptics.test.ts +202 -0
  220. package/src/__tests__/jobs.test.ts +130 -0
  221. package/src/__tests__/keyboardCover.test.ts +84 -0
  222. package/src/__tests__/liveCard.test.ts +39 -0
  223. package/src/__tests__/lockedPhone.test.ts +355 -0
  224. package/src/__tests__/lucyMotion.test.ts +34 -0
  225. package/src/__tests__/platform.test.ts +32 -0
  226. package/src/__tests__/powerOn.test.ts +62 -0
  227. package/src/__tests__/protocol.test.ts +125 -0
  228. package/src/__tests__/push.test.ts +111 -0
  229. package/src/__tests__/results.test.ts +256 -0
  230. package/src/__tests__/sound.test.ts +248 -0
  231. package/src/__tests__/talkToLucy.test.ts +205 -0
  232. package/src/__tests__/textLink.test.ts +91 -0
  233. package/src/__tests__/voiceDial.test.ts +53 -0
  234. package/src/__tests__/welcomeFlow.test.ts +157 -0
  235. package/src/__tests__/whereLucyWorks.test.ts +81 -0
  236. package/src/__tests__/yantraLinks.test.ts +96 -0
  237. package/src/assets/home/loop-day.jpg +0 -0
  238. package/src/assets/home/loop-day.mp4 +0 -0
  239. package/src/assets/home/loop-time-back.jpg +0 -0
  240. package/src/assets/home/loop-time-back.mp4 +0 -0
  241. package/src/assets/home/loop-where.jpg +0 -0
  242. package/src/assets/home/loop-where.mp4 +0 -0
  243. package/src/assets/home/reel-gym.jpg +0 -0
  244. package/src/assets/home/reel-gym.mp4 +0 -0
  245. package/src/assets/home/reel-internet.jpg +0 -0
  246. package/src/assets/home/reel-internet.mp4 +0 -0
  247. package/src/assets/icon.png +0 -0
  248. package/src/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
  249. package/src/assets/lottie/lucy-mark-calendar.json +1827 -0
  250. package/src/assets/lottie/lucy-mark-call.json +1470 -0
  251. package/src/assets/lottie/lucy-mark-connect.json +2552 -0
  252. package/src/assets/lottie/lucy-mark-details.json +1735 -0
  253. package/src/assets/lottie/lucy-mark-email.json +1363 -0
  254. package/src/assets/lottie/lucy-mark-message.json +1154 -0
  255. package/src/assets/lottie/lucy-mark-search.json +1067 -0
  256. package/src/assets/lottie/lucy-mark-think.json +1253 -0
  257. package/src/assets/lottie/lucy-mark-write.json +1532 -0
  258. package/src/assets/lottie/time-back.json +16458 -0
  259. package/src/assets/lottie/where-lucy-works-chat.json +6170 -0
  260. package/src/assets/lottie/where-lucy-works-cloud.json +10066 -0
  261. package/src/assets/lottie/where-lucy-works-mine-none.json +2478 -0
  262. package/src/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
  263. package/src/assets/lottie/where-lucy-works-mine-online.json +7881 -0
  264. package/src/assets/sounds/hours-back.m4a +0 -0
  265. package/src/assets/sounds/meet-lucy.m4a +0 -0
  266. package/src/assets/sounds/power-on.m4a +0 -0
  267. package/src/assets/sounds/wind-back.m4a +0 -0
  268. package/src/assets/sounds/youre-in.m4a +0 -0
  269. package/src/chat/.claude-flow/data/pending-insights.jsonl +1 -0
  270. package/src/chat/agent.ts +376 -0
  271. package/src/chat/appFront.ts +39 -0
  272. package/src/chat/auth.ts +433 -0
  273. package/src/chat/chores.ts +394 -0
  274. package/src/chat/connectors.ts +75 -0
  275. package/src/chat/jobs.ts +228 -0
  276. package/src/chat/lucyMotion.ts +33 -0
  277. package/src/chat/protocol.ts +192 -0
  278. package/src/chat/results.ts +224 -0
  279. package/src/chat/store.ts +87 -0
  280. package/src/chat/useDictation.ts +201 -0
  281. package/src/chat/useLucyChat.ts +458 -0
  282. package/src/chat/useMyComputer.ts +41 -0
  283. package/src/chat/whereLucyWorks.ts +97 -0
  284. package/src/chat/workspace.ts +127 -0
  285. package/src/components/.claude-flow/data/pending-insights.jsonl +3 -0
  286. package/src/components/AreaShot.tsx +239 -0
  287. package/src/components/Backdrops.tsx +323 -0
  288. package/src/components/BottomSheet.tsx +96 -0
  289. package/src/components/ChatSheets.tsx +565 -0
  290. package/src/components/ConnectorLogo.tsx +116 -0
  291. package/src/components/CustomDrawer.tsx +526 -0
  292. package/src/components/IdeasPane.tsx +318 -0
  293. package/src/components/ImessageSheet.tsx +280 -0
  294. package/src/components/KeyboardAvoider.tsx +45 -0
  295. package/src/components/Logo.tsx +97 -0
  296. package/src/components/LucyWorking.tsx +122 -0
  297. package/src/components/Markdown.tsx +219 -0
  298. package/src/components/Media.tsx +173 -0
  299. package/src/components/MessagesAppIcon.tsx +51 -0
  300. package/src/components/MicButton.tsx +92 -0
  301. package/src/components/ResultCards.tsx +1067 -0
  302. package/src/components/SignInPrompt.tsx +182 -0
  303. package/src/components/SignedOut.tsx +47 -0
  304. package/src/components/TalkToLucyHero.tsx +540 -0
  305. package/src/components/TalkToLucySheet.tsx +208 -0
  306. package/src/components/VoiceOrb.tsx +364 -0
  307. package/src/components/WhereLucyWorks.tsx +261 -0
  308. package/src/components/WorkspaceSection.tsx +307 -0
  309. package/src/components/YantraMark.tsx +30 -0
  310. package/src/components/drawerHeader.tsx +46 -0
  311. package/src/components/kit.tsx +309 -0
  312. package/src/components/lottieInstalled.ts +7 -0
  313. package/src/components/ui.tsx +700 -0
  314. package/src/components/useSignOut.ts +21 -0
  315. package/src/components/viewport.tsx +166 -0
  316. package/src/components/voiceDial.ts +45 -0
  317. package/src/compute.ts +168 -0
  318. package/src/config/env-config.ts +50 -0
  319. package/src/config/routes.ts +28 -0
  320. package/src/content.ts +217 -0
  321. package/src/hooks/keyboardCover.ts +70 -0
  322. package/src/hooks/useKeyboard.ts +135 -0
  323. package/src/hooks/useReducedMotion.ts +19 -0
  324. package/src/imessage/openMessages.ts +53 -0
  325. package/src/imessage/platform.ts +32 -0
  326. package/src/imessage/textLink.ts +307 -0
  327. package/src/index.ts +24 -0
  328. package/src/live/card.ts +62 -0
  329. package/src/live/liveActivity.ts +192 -0
  330. package/src/module.ts +8 -0
  331. package/src/offer/BlackFridayOffer.tsx +394 -0
  332. package/src/offer/blackFriday.ts +109 -0
  333. package/src/offer/parts.tsx +650 -0
  334. package/src/offer/state.ts +78 -0
  335. package/src/push/push.ts +171 -0
  336. package/src/push/usePushNotifications.ts +47 -0
  337. package/src/screens/Account/index.tsx +310 -0
  338. package/src/screens/Chat/.claude-flow/data/pending-insights.jsonl +4 -0
  339. package/src/screens/Chat/index.tsx +891 -0
  340. package/src/screens/Chores/index.tsx +35 -0
  341. package/src/screens/Connectors/index.tsx +35 -0
  342. package/src/screens/History/index.tsx +346 -0
  343. package/src/screens/Home/index.tsx +2776 -0
  344. package/src/screens/Home/media.ts +31 -0
  345. package/src/screens/Welcome/index.tsx +1182 -0
  346. package/src/talk/talkToLucy.ts +187 -0
  347. package/src/theme/colors.ts +38 -0
  348. package/src/theme/fonts.ts +30 -0
  349. package/src/theme/muse.ts +86 -0
  350. package/src/utils/links.ts +84 -0
  351. package/src/utils/yantraLinks.ts +94 -0
  352. package/src/welcome/flow.ts +418 -0
  353. package/src/welcome/haptics.ts +179 -0
  354. package/src/welcome/parts.tsx +2160 -0
  355. package/src/welcome/powerOn.ts +84 -0
  356. package/src/welcome/seen.ts +68 -0
  357. package/src/welcome/sound.ts +173 -0
  358. package/tools/lottie/chat.motion +0 -0
  359. package/tools/lottie/cloud.motion +0 -0
  360. package/tools/lottie/generate.mjs +1209 -0
  361. package/tools/lottie/inter-glyphs.json +4416 -0
  362. package/tools/lottie/lucy-mark-calendar.motion +0 -0
  363. package/tools/lottie/lucy-mark-call.motion +0 -0
  364. package/tools/lottie/lucy-mark-connect.motion +0 -0
  365. package/tools/lottie/lucy-mark-details.motion +0 -0
  366. package/tools/lottie/lucy-mark-email.motion +0 -0
  367. package/tools/lottie/lucy-mark-message.motion +0 -0
  368. package/tools/lottie/lucy-mark-search.motion +0 -0
  369. package/tools/lottie/lucy-mark-think.motion +0 -0
  370. package/tools/lottie/lucy-mark-write.motion +0 -0
  371. package/tools/lottie/mark.json +1 -0
  372. package/tools/lottie/mine-none.motion +0 -0
  373. package/tools/lottie/mine-offline.motion +0 -0
  374. package/tools/lottie/mine-online.motion +0 -0
  375. package/tools/lottie/time-back.mjs +604 -0
  376. package/tools/sounds/render.mjs +730 -0
  377. package/tsconfig.json +17 -0
  378. package/README.md +0 -3
@@ -0,0 +1,2160 @@
1
+ /**
2
+ * The welcome's pieces (screens/Welcome), drawn natively with react-native-svg: Lucy's orb (the Clockbook mark, lit),
3
+ * the intro's dial, Lucy's lines arriving word by word, the ember button, the rolling years and the hours odometer,
4
+ * the framed previews of what comes next, the burst at the end, the sunset and the lock-screen reminder.
5
+ *
6
+ * Everything moves with React Native's Animated on the native driver (as components/Logo.tsx and Backdrops.tsx do),
7
+ * and `still` (Reduce Motion) puts every piece straight in its final place.
8
+ */
9
+ import React, { useEffect, useId, useMemo, useRef, useState } from 'react';
10
+ import {
11
+ ActivityIndicator,
12
+ Animated,
13
+ Easing,
14
+ Platform,
15
+ Pressable,
16
+ StatusBar,
17
+ StyleSheet,
18
+ Text,
19
+ View,
20
+ type StyleProp,
21
+ type TextStyle,
22
+ type ViewStyle,
23
+ } from 'react-native';
24
+ import Svg, { Circle, Defs, Ellipse, LinearGradient, Path, RadialGradient, Rect, Stop } from 'react-native-svg';
25
+ import { Ionicons } from '@expo/vector-icons';
26
+ import { Mark, MARK } from '../components/Logo';
27
+ import { fonts } from '../theme/fonts';
28
+ import { ui } from '../theme/muse';
29
+ import { odometerColumns, rollRows, WIND_BACK, WORD_FADE_MS, WORD_MS, yearsLabel, type Word } from './flow';
30
+ import { powerOn, reel, success, tap, thud, ticks, writing } from './haptics';
31
+ import { POWER_ON, tickLitAt } from './powerOn';
32
+ import { play } from './sound';
33
+
34
+ /** Every button here taps the phone lightly as it is pressed. */
35
+ function pressed(action: () => void): void {
36
+ tap();
37
+ action();
38
+ }
39
+
40
+ export type IconName = React.ComponentProps<typeof Ionicons>['name'];
41
+
42
+ const EASE = Easing.bezier(0.2, 0.7, 0.2, 1);
43
+ const hidden = { accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' } as const;
44
+ const AnimatedPath = Animated.createAnimatedComponent(Path);
45
+
46
+ /** Gradient ids must not repeat across Svgs on some platforms, so every one gets its own. */
47
+ function useSvgId(name: string): string {
48
+ return `${name}${useId().replace(/[^a-zA-Z0-9]/g, '')}`;
49
+ }
50
+
51
+ /** A glow under a thing, on iOS only: Android's elevation draws a grey slab instead. */
52
+ function glowShadow(radius: number, opacity: number): ViewStyle {
53
+ return Platform.OS === 'ios'
54
+ ? {
55
+ shadowColor: ui.accent,
56
+ shadowOpacity: opacity,
57
+ shadowRadius: radius,
58
+ shadowOffset: { width: 0, height: 0 },
59
+ }
60
+ : {};
61
+ }
62
+
63
+ /* ---------------------------------------------------------------------------------------------- arriving */
64
+
65
+ /** Fades and rises its children into place after `delay`. */
66
+ export function Reveal({
67
+ delay = 0,
68
+ still = false,
69
+ rise = 12,
70
+ from = 0,
71
+ to = 1,
72
+ style,
73
+ children,
74
+ }: {
75
+ delay?: number;
76
+ still?: boolean;
77
+ rise?: number;
78
+ /** Opacity to start from and settle at: a line that was current settles at its faded look. */
79
+ from?: number;
80
+ to?: number;
81
+ style?: StyleProp<ViewStyle>;
82
+ children: React.ReactNode;
83
+ }) {
84
+ const v = useRef(new Animated.Value(still ? 1 : 0)).current;
85
+ useEffect(() => {
86
+ if (still) {
87
+ v.setValue(1);
88
+ return undefined;
89
+ }
90
+ const anim = Animated.timing(v, { toValue: 1, duration: 650, delay, easing: EASE, useNativeDriver: true });
91
+ anim.start();
92
+ return () => anim.stop();
93
+ }, [delay, still, v]);
94
+ return (
95
+ <Animated.View
96
+ style={[
97
+ style,
98
+ {
99
+ opacity: v.interpolate({ inputRange: [0, 1], outputRange: [from, to] }),
100
+ transform: [{ translateY: v.interpolate({ inputRange: [0, 1], outputRange: [rise, 0] }) }],
101
+ },
102
+ ]}
103
+ >
104
+ {children}
105
+ </Animated.View>
106
+ );
107
+ }
108
+
109
+ /** A line written word by word from `start`; screen readers get it whole. */
110
+ export function Words({
111
+ words,
112
+ label,
113
+ start = 0,
114
+ still = false,
115
+ style,
116
+ accent,
117
+ center = false,
118
+ gap = 5,
119
+ }: {
120
+ words: Word[];
121
+ label: string;
122
+ start?: number;
123
+ still?: boolean;
124
+ style: StyleProp<TextStyle>;
125
+ accent?: StyleProp<TextStyle>;
126
+ center?: boolean;
127
+ gap?: number;
128
+ }) {
129
+ const span = WORD_FADE_MS / WORD_MS;
130
+ const total = words.length + span;
131
+ const p = useRef(new Animated.Value(still ? total : 0)).current;
132
+ useEffect(() => {
133
+ if (still) {
134
+ p.setValue(total);
135
+ return undefined;
136
+ }
137
+ const anim = Animated.timing(p, {
138
+ toValue: total,
139
+ duration: total * WORD_MS,
140
+ delay: start,
141
+ easing: Easing.linear,
142
+ useNativeDriver: true,
143
+ });
144
+ anim.start();
145
+ // The writing felt as well as seen: a light tick every few words as they land (haptics.ts, `writing`).
146
+ const cancel = writing(words.length, WORD_MS, start + 120);
147
+ return () => {
148
+ anim.stop();
149
+ cancel();
150
+ };
151
+ }, [p, start, still, total, words.length]);
152
+ return (
153
+ <View
154
+ accessible
155
+ accessibilityRole="text"
156
+ accessibilityLabel={label}
157
+ style={[s.words, { columnGap: gap }, center && s.wordsCenter]}
158
+ >
159
+ {words.map((w, i) => (
160
+ <Animated.Text
161
+ key={i}
162
+ {...hidden}
163
+ style={[
164
+ style,
165
+ {
166
+ opacity: p.interpolate({
167
+ inputRange: [i, i + span],
168
+ outputRange: [0, 1],
169
+ extrapolate: 'clamp',
170
+ }),
171
+ transform: [
172
+ {
173
+ translateY: p.interpolate({
174
+ inputRange: [i, i + span],
175
+ outputRange: [7, 0],
176
+ extrapolate: 'clamp',
177
+ }),
178
+ },
179
+ ],
180
+ },
181
+ ]}
182
+ >
183
+ {w.a ? <Text style={accent}>{w.a}</Text> : null}
184
+ {w.b}
185
+ </Animated.Text>
186
+ ))}
187
+ </View>
188
+ );
189
+ }
190
+
191
+ /** A plain line, already written (one of the faded lines above Lucy's newest). */
192
+ export function StaticWords({
193
+ words,
194
+ label,
195
+ style,
196
+ accent,
197
+ gap = 5,
198
+ }: {
199
+ words: Word[];
200
+ label: string;
201
+ style: StyleProp<TextStyle>;
202
+ accent?: StyleProp<TextStyle>;
203
+ gap?: number;
204
+ }) {
205
+ return (
206
+ <View accessible accessibilityRole="text" accessibilityLabel={label} style={[s.words, { columnGap: gap }]}>
207
+ {words.map((w, i) => (
208
+ <Text key={i} {...hidden} style={style}>
209
+ {w.a ? <Text style={accent}>{w.a}</Text> : null}
210
+ {w.b}
211
+ </Text>
212
+ ))}
213
+ </View>
214
+ );
215
+ }
216
+
217
+ /* ---------------------------------------------------------------------------------------------- Lucy */
218
+
219
+ /**
220
+ * Lucy: the Clockbook mark lit from inside, a soft halo breathing behind it, its minute hand rewinding one turn every
221
+ * 2.4 s (as components/Logo.tsx AnimatedMark), or spinning while she thinks.
222
+ */
223
+ export function LucyOrb({
224
+ size = 92,
225
+ think = false,
226
+ still = false,
227
+ }: {
228
+ size?: number;
229
+ think?: boolean;
230
+ still?: boolean;
231
+ }) {
232
+ const face = useSvgId('orbFace');
233
+ const spec = useSvgId('orbSpec');
234
+ const halo = useSvgId('orbHalo');
235
+ const turn = useRef(new Animated.Value(0)).current;
236
+ const breathe = useRef(new Animated.Value(0.5)).current;
237
+
238
+ useEffect(() => {
239
+ turn.setValue(0);
240
+ if (still) return undefined;
241
+ const loop = Animated.loop(
242
+ Animated.timing(turn, {
243
+ toValue: 1,
244
+ duration: think ? 750 : 2400,
245
+ easing: think ? Easing.linear : Easing.inOut(Easing.cubic),
246
+ useNativeDriver: true,
247
+ }),
248
+ );
249
+ loop.start();
250
+ return () => loop.stop();
251
+ }, [still, think, turn]);
252
+
253
+ useEffect(() => {
254
+ if (still) {
255
+ breathe.setValue(0.5);
256
+ return undefined;
257
+ }
258
+ const loop = Animated.loop(
259
+ Animated.sequence([
260
+ Animated.timing(breathe, {
261
+ toValue: 1,
262
+ duration: 1800,
263
+ easing: Easing.inOut(Easing.sin),
264
+ useNativeDriver: true,
265
+ }),
266
+ Animated.timing(breathe, {
267
+ toValue: 0,
268
+ duration: 1800,
269
+ easing: Easing.inOut(Easing.sin),
270
+ useNativeDriver: true,
271
+ }),
272
+ ]),
273
+ );
274
+ loop.start();
275
+ return () => loop.stop();
276
+ }, [breathe, still]);
277
+
278
+ const unit = size / 18;
279
+ const dx = (MARK.PIVOT.x + 1 - 9) * unit;
280
+ const dy = (MARK.PIVOT.y + 1 - 9) * unit;
281
+ const rotate = turn.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '-360deg'] });
282
+ const H = size * 2.6;
283
+
284
+ return (
285
+ <View style={{ width: size, height: size }} {...hidden}>
286
+ <Animated.View
287
+ pointerEvents="none"
288
+ style={{
289
+ position: 'absolute',
290
+ left: (size - H) / 2,
291
+ top: (size - H) / 2,
292
+ width: H,
293
+ height: H,
294
+ opacity: breathe.interpolate({ inputRange: [0, 1], outputRange: [0.7, 1] }),
295
+ transform: [{ scale: breathe.interpolate({ inputRange: [0, 1], outputRange: [0.94, 1.06] }) }],
296
+ }}
297
+ >
298
+ <Svg width={H} height={H}>
299
+ <Defs>
300
+ <RadialGradient id={halo} cx="50%" cy="50%" r="50%">
301
+ <Stop offset="0" stopColor="#FF6A14" stopOpacity={0.36} />
302
+ <Stop offset="0.45" stopColor="#FF5A00" stopOpacity={0.12} />
303
+ <Stop offset="1" stopColor="#FF5A00" stopOpacity={0} />
304
+ </RadialGradient>
305
+ </Defs>
306
+ <Circle cx={H / 2} cy={H / 2} r={H / 2} fill={`url(#${halo})`} />
307
+ </Svg>
308
+ </Animated.View>
309
+ <View style={[StyleSheet.absoluteFill, s.orbShadow]}>
310
+ <Svg width={size} height={size} viewBox="-1 -1 18 18">
311
+ <Defs>
312
+ <RadialGradient id={face} cx="36%" cy="30%" r="80%">
313
+ <Stop offset="0" stopColor="#FFC08F" />
314
+ <Stop offset="0.38" stopColor="#FF7A2C" />
315
+ <Stop offset="0.72" stopColor="#FF5A00" />
316
+ <Stop offset="1" stopColor="#D64700" />
317
+ </RadialGradient>
318
+ <RadialGradient id={spec} cx="50%" cy="50%" r="50%">
319
+ <Stop offset="0" stopColor="#FFFFFF" stopOpacity={0.75} />
320
+ <Stop offset="1" stopColor="#FFFFFF" stopOpacity={0} />
321
+ </RadialGradient>
322
+ </Defs>
323
+ <Path d={MARK.BACK} fill="#FF5A00" opacity={0.28} />
324
+ <Path d={MARK.FACE} fill={`url(#${face})`} />
325
+ <Ellipse cx={5.3} cy={4.5} rx={3.2} ry={2} fill={`url(#${spec})`} transform="rotate(-28 5.3 4.5)" />
326
+ <Path d={MARK.HOUR} fill="none" stroke="#fff" strokeWidth={0.86} strokeLinecap="round" />
327
+ </Svg>
328
+ </View>
329
+ <Animated.View
330
+ style={{
331
+ position: 'absolute',
332
+ width: size,
333
+ height: size,
334
+ transform: [
335
+ { translateX: dx },
336
+ { translateY: dy },
337
+ { rotate },
338
+ { translateX: -dx },
339
+ { translateY: -dy },
340
+ ],
341
+ }}
342
+ >
343
+ <Svg width={size} height={size} viewBox="-1 -1 18 18">
344
+ <Path d={MARK.MINUTE} fill="none" stroke="#fff" strokeWidth={0.86} strokeLinecap="round" />
345
+ </Svg>
346
+ </Animated.View>
347
+ </View>
348
+ );
349
+ }
350
+
351
+ /* ---------------------------------------------------------------------------------------------- the glow */
352
+
353
+ export type GlowMode = 'dim' | 'on' | 'lit' | 'wide' | 'yay' | 'off';
354
+
355
+ /** The warm light behind everything: up top while Lucy talks, round the dial as it lights, gone on the sunset. */
356
+ export function Glow({
357
+ mode,
358
+ width,
359
+ top,
360
+ dialY,
361
+ yayY,
362
+ still,
363
+ }: {
364
+ mode: GlowMode;
365
+ width: number;
366
+ /** Where it sits while Lucy talks (the orb's middle). */
367
+ top: number;
368
+ dialY: number;
369
+ yayY: number;
370
+ still: boolean;
371
+ }) {
372
+ const id = useSvgId('glow');
373
+ const warm = useSvgId('warm');
374
+ const W = width * 2.2;
375
+ const H = width * 1.9;
376
+ const at = {
377
+ dim: { o: 0.35, y: top - 70, s: 1 },
378
+ on: { o: 1, y: top - 40, s: 1 },
379
+ lit: { o: 1, y: dialY, s: 0.9 },
380
+ wide: { o: 0.9, y: top - 20, s: 1.12 },
381
+ yay: { o: 1, y: yayY, s: 1 },
382
+ off: { o: 0, y: top - 40, s: 1 },
383
+ }[mode];
384
+ const op = useRef(new Animated.Value(at.o)).current;
385
+ const ty = useRef(new Animated.Value(at.y - H / 2)).current;
386
+ const sc = useRef(new Animated.Value(at.s)).current;
387
+ const drift = useRef(new Animated.Value(0)).current;
388
+
389
+ useEffect(() => {
390
+ const cfg = { duration: still ? 0 : 1300, easing: EASE, useNativeDriver: true };
391
+ const anim = Animated.parallel([
392
+ Animated.timing(op, { ...cfg, toValue: at.o }),
393
+ Animated.timing(ty, { ...cfg, toValue: at.y - H / 2 }),
394
+ Animated.timing(sc, { ...cfg, toValue: at.s }),
395
+ ]);
396
+ anim.start();
397
+ return () => anim.stop();
398
+ }, [H, at.o, at.s, at.y, op, sc, still, ty]);
399
+
400
+ useEffect(() => {
401
+ if (still) return undefined;
402
+ const loop = Animated.loop(
403
+ Animated.sequence([
404
+ Animated.timing(drift, {
405
+ toValue: 1,
406
+ duration: 10000,
407
+ easing: Easing.inOut(Easing.sin),
408
+ useNativeDriver: true,
409
+ }),
410
+ Animated.timing(drift, {
411
+ toValue: 0,
412
+ duration: 10000,
413
+ easing: Easing.inOut(Easing.sin),
414
+ useNativeDriver: true,
415
+ }),
416
+ ]),
417
+ );
418
+ loop.start();
419
+ return () => loop.stop();
420
+ }, [drift, still]);
421
+
422
+ return (
423
+ <Animated.View
424
+ pointerEvents="none"
425
+ {...hidden}
426
+ style={{
427
+ position: 'absolute',
428
+ left: (width - W) / 2,
429
+ top: 0,
430
+ width: W,
431
+ height: H,
432
+ opacity: op,
433
+ transform: [{ translateY: ty }, { scale: sc }],
434
+ }}
435
+ >
436
+ <Svg width={W} height={H}>
437
+ <Defs>
438
+ <RadialGradient id={id} cx="50%" cy="50%" r="50%">
439
+ <Stop offset="0" stopColor="#FF6A14" stopOpacity={0.26} />
440
+ <Stop offset="0.55" stopColor="#FFB27A" stopOpacity={0.22} />
441
+ <Stop offset="1" stopColor="#FFB27A" stopOpacity={0} />
442
+ </RadialGradient>
443
+ </Defs>
444
+ <Ellipse cx={W / 2} cy={H / 2} rx={W / 2} ry={H / 2} fill={`url(#${id})`} />
445
+ </Svg>
446
+ <Animated.View
447
+ style={{
448
+ position: 'absolute',
449
+ left: W * 0.22,
450
+ top: H * 0.44,
451
+ width: W * 0.56,
452
+ height: H * 0.34,
453
+ transform: [
454
+ { translateX: drift.interpolate({ inputRange: [0, 1], outputRange: [-W * 0.08, W * 0.1] }) },
455
+ ],
456
+ }}
457
+ >
458
+ <Svg width={W * 0.56} height={H * 0.34}>
459
+ <Defs>
460
+ <RadialGradient id={warm} cx="50%" cy="50%" r="50%">
461
+ <Stop offset="0" stopColor="#FFC878" stopOpacity={0.3} />
462
+ <Stop offset="1" stopColor="#FFC878" stopOpacity={0} />
463
+ </RadialGradient>
464
+ </Defs>
465
+ <Ellipse cx={W * 0.28} cy={H * 0.17} rx={W * 0.28} ry={H * 0.17} fill={`url(#${warm})`} />
466
+ </Svg>
467
+ </Animated.View>
468
+ </Animated.View>
469
+ );
470
+ }
471
+
472
+ /* ---------------------------------------------------------------------------------------------- the dial */
473
+
474
+ /** A hand's angle in degrees, turning a full turn every `period` ms (backwards when `dir` is -1) from where it was. */
475
+ function useHand(period: number, dir: 1 | -1, rest: number, still: boolean): Animated.Value {
476
+ const angle = useRef(new Animated.Value(rest)).current;
477
+ useEffect(() => {
478
+ if (still) {
479
+ angle.stopAnimation();
480
+ angle.setValue(rest);
481
+ return undefined;
482
+ }
483
+ let loop: Animated.CompositeAnimation | null = null;
484
+ let alive = true;
485
+ angle.stopAnimation((from) => {
486
+ if (!alive) return;
487
+ const start = Number.isFinite(from) ? from % 360 : rest;
488
+ angle.setValue(start);
489
+ loop = Animated.loop(
490
+ Animated.timing(angle, {
491
+ toValue: start + dir * 360,
492
+ duration: period,
493
+ easing: Easing.linear,
494
+ useNativeDriver: true,
495
+ }),
496
+ );
497
+ loop.start();
498
+ });
499
+ return () => {
500
+ alive = false;
501
+ loop?.stop();
502
+ };
503
+ }, [angle, dir, period, rest, still]);
504
+ return angle;
505
+ }
506
+
507
+ function Hand({
508
+ angle,
509
+ size,
510
+ length,
511
+ width,
512
+ glow,
513
+ }: {
514
+ angle: Animated.Value;
515
+ size: number;
516
+ length: number;
517
+ width: number;
518
+ glow?: boolean;
519
+ }) {
520
+ const r = size / 2;
521
+ const rotate = angle.interpolate({ inputRange: [-3600, 3600], outputRange: ['-3600deg', '3600deg'] });
522
+ return (
523
+ <Animated.View style={[StyleSheet.absoluteFill, { transform: [{ rotate }] }]}>
524
+ <View
525
+ style={[
526
+ s.hand,
527
+ { left: r - width / 2, top: r - length, width, height: length, borderRadius: width / 2 },
528
+ glow && glowShadow(8, 0.9),
529
+ ]}
530
+ />
531
+ </Animated.View>
532
+ );
533
+ }
534
+
535
+ const TICKS = Array.from({ length: 60 }, (_, i) => i);
536
+
537
+ /**
538
+ * The intro's clock. Beat 1: the hands race forward (the hours slipping away). Beat 2: it draws closer and slows.
539
+ * Beat 3: the hands wind backwards while the ticks light up, anticlockwise from twelve. Beat 4: it shrinks into Lucy.
540
+ */
541
+ export function Dial({ beat, size, still }: { beat: 1 | 2 | 3 | 4; size: number; still: boolean }) {
542
+ const lit = useRef(new Animated.Value(beat >= 3 ? 1 : 0)).current;
543
+ const scale = useRef(new Animated.Value(beat === 1 ? 1 : beat === 4 ? 0.32 : 1.2)).current;
544
+ const fade = useRef(new Animated.Value(beat === 4 ? 0 : 1)).current;
545
+
546
+ useEffect(() => {
547
+ const ms = (n: number) => (still ? 0 : n);
548
+ const anim = Animated.parallel([
549
+ Animated.timing(scale, {
550
+ toValue: beat === 1 ? 1 : beat === 4 ? 0.32 : 1.2,
551
+ duration: ms(1200),
552
+ easing: EASE,
553
+ useNativeDriver: true,
554
+ }),
555
+ Animated.timing(fade, {
556
+ toValue: beat === 4 ? 0 : 1,
557
+ duration: ms(900),
558
+ easing: EASE,
559
+ useNativeDriver: true,
560
+ }),
561
+ Animated.timing(lit, {
562
+ toValue: beat >= 3 ? 1 : 0,
563
+ duration: ms(WIND_BACK.lit),
564
+ easing: Easing.linear,
565
+ useNativeDriver: true,
566
+ }),
567
+ ]);
568
+ anim.start();
569
+ // The ticks lighting up anticlockwise, felt as a quick run of ticks and heard winding back (sound.ts).
570
+ const winding = beat === 3 && !still;
571
+ const cancel = winding ? ticks(WIND_BACK.count, WIND_BACK.every, WIND_BACK.start) : () => undefined;
572
+ const hush = winding ? play('windBack') : () => undefined;
573
+ return () => {
574
+ anim.stop();
575
+ cancel();
576
+ hush();
577
+ };
578
+ }, [beat, fade, lit, scale, still]);
579
+
580
+ const back = beat >= 3;
581
+ const minute = useHand(beat === 1 ? 4000 : beat === 2 ? 10000 : 1000, back ? -1 : 1, 60, still);
582
+ const hour = useHand(beat === 1 ? 48000 : beat === 2 ? 120000 : 12000, back ? -1 : 1, -60, still);
583
+ const r = size / 2;
584
+
585
+ return (
586
+ <Animated.View {...hidden} style={{ width: size, height: size, opacity: fade, transform: [{ scale }] }}>
587
+ <View
588
+ style={[
589
+ StyleSheet.absoluteFill,
590
+ { borderRadius: r, borderWidth: StyleSheet.hairlineWidth, borderColor: ui.hairline },
591
+ ]}
592
+ />
593
+ {TICKS.map((i) => (
594
+ <View key={i} style={[StyleSheet.absoluteFill, { transform: [{ rotate: `${i * 6}deg` }] }]}>
595
+ <View style={i % 5 === 0 ? s.tickMajor : s.tick} />
596
+ </View>
597
+ ))}
598
+ {TICKS.map((i) => {
599
+ const k = (60 - i) % 60;
600
+ return (
601
+ <Animated.View
602
+ key={`lit${i}`}
603
+ style={[
604
+ StyleSheet.absoluteFill,
605
+ {
606
+ opacity: lit.interpolate({
607
+ inputRange: [k / 60, Math.min(1, (k + 4) / 60)],
608
+ outputRange: [0, 1],
609
+ extrapolate: 'clamp',
610
+ }),
611
+ transform: [{ rotate: `${i * 6}deg` }],
612
+ },
613
+ ]}
614
+ >
615
+ <View style={[i % 5 === 0 ? s.tickMajor : s.tick, i % 5 === 0 ? s.tickMajorLit : s.tickLit]} />
616
+ </Animated.View>
617
+ );
618
+ })}
619
+ <Hand angle={hour} size={size} length={size * 0.25} width={5} />
620
+ <Hand angle={minute} size={size} length={size * 0.386} width={3} glow={back} />
621
+ <View style={[s.pin, back && s.pinLit, { left: r - 6.5, top: r - 6.5 }]} />
622
+ </Animated.View>
623
+ );
624
+ }
625
+
626
+ /* ------------------------------------------------------------------------------------------- the power-on */
627
+
628
+ /** One of the power-on's keyframes: [ms, value, the easing into it]. */
629
+ type Key = [number, number, ((x: number) => number)?];
630
+
631
+ /**
632
+ * A value along keyframes over the power-on's clock `t` (ms), each leg eased as its end key says. Sampled into plain
633
+ * points, since the native driver runs interpolations but not easing functions.
634
+ */
635
+ function curve(t: Animated.Value, keys: Key[]): Animated.AnimatedInterpolation<number> {
636
+ const input = [keys[0][0]];
637
+ const output = [keys[0][1]];
638
+ for (let k = 1; k < keys.length; k++) {
639
+ const [t0, v0] = keys[k - 1];
640
+ const [t1, v1, ease] = keys[k];
641
+ const steps = ease ? 10 : 1;
642
+ for (let i = 1; i <= steps; i++) {
643
+ const f = i / steps;
644
+ input.push(t0 + (t1 - t0) * f);
645
+ output.push(v0 + (v1 - v0) * (ease ? ease(f) : f));
646
+ }
647
+ }
648
+ return t.interpolate({ inputRange: input, outputRange: output, extrapolate: 'clamp' });
649
+ }
650
+
651
+ /** A ring leaving Lucy: `alpha` strong at `at` ms, fading over `ms` as it grows from `from` to `to` times her size. */
652
+ function ring(t: Animated.Value, at: number, ms: number, alpha: number, from: number, to: number) {
653
+ return {
654
+ opacity: curve(t, [
655
+ [at - 1, 0],
656
+ [at, alpha],
657
+ [at + ms, 0, OUT],
658
+ ]),
659
+ scale: curve(t, [
660
+ [at, from],
661
+ [at + ms, to, OUT],
662
+ ]),
663
+ };
664
+ }
665
+
666
+ /** A hand's length growing out of the pin: scaled from its pin end, not its middle. */
667
+ function fromPin(scale: Animated.AnimatedInterpolation<number>, length: number) {
668
+ return scale.interpolate({ inputRange: [0, 1], outputRange: [length / 2, 0] });
669
+ }
670
+
671
+ const OUT = Easing.out(Easing.cubic);
672
+ const IN = Easing.in(Easing.cubic);
673
+ const IN_OUT = Easing.inOut(Easing.cubic);
674
+ /** Past twelve and back: the minute hand's click into place. */
675
+ const SNAP = Easing.bezier(0.2, 0.9, 0.25, 1.35);
676
+ const INK_BG = '#0E0B09';
677
+ const EMBER = '#FF8A3D';
678
+ const PO_MARK = 112;
679
+ const PO_GLOW = 320;
680
+ const PO_FLASH = 170;
681
+ const PO_CREAM = 100;
682
+
683
+ /**
684
+ * The power-on (powerOn.ts): the welcome's first moment, played over it until its first screen takes over. It draws
685
+ * the intro's own clock, Dial's size and place with its ticks, hands and pin, so its last frame is Dial's first. The
686
+ * vibration (haptics.ts, powerOn) runs on the same clock. Tap to skip.
687
+ */
688
+ export function PowerOn({
689
+ size,
690
+ center,
691
+ width,
692
+ height,
693
+ onDone,
694
+ }: {
695
+ /** The intro clock's size and middle, as the welcome lays them out. */
696
+ size: number;
697
+ center: { x: number; y: number };
698
+ width: number;
699
+ height: number;
700
+ onDone: () => void;
701
+ }) {
702
+ const t = useRef(new Animated.Value(0)).current;
703
+ const done = useRef(onDone);
704
+ done.current = onDone;
705
+ const [dark, setDark] = useState(true);
706
+ const glowId = useSvgId('poGlow');
707
+ const flashId = useSvgId('poFlash');
708
+
709
+ useEffect(() => {
710
+ let playedThrough = false;
711
+ const anim = Animated.timing(t, {
712
+ toValue: POWER_ON.done,
713
+ duration: POWER_ON.done,
714
+ easing: Easing.linear,
715
+ useNativeDriver: true,
716
+ });
717
+ anim.start(({ finished }) => {
718
+ if (!finished) return;
719
+ playedThrough = true;
720
+ done.current();
721
+ });
722
+ const stopBuzz = powerOn();
723
+ // Heard as well as felt (sound.ts). Skipped, it stops with the rest; played through, its chord rings on into
724
+ // the welcome's first screen.
725
+ const stopSound = play('powerOn');
726
+ // Light status bar on the dark; dark again once the cream is in.
727
+ const cream = setTimeout(() => setDark(false), POWER_ON.ignite + 160);
728
+ return () => {
729
+ anim.stop();
730
+ stopBuzz();
731
+ if (!playedThrough) stopSound();
732
+ clearTimeout(cream);
733
+ };
734
+ }, [t]);
735
+
736
+ const r = size / 2;
737
+ const minute = size * 0.386;
738
+ const hour = size * 0.25;
739
+ // Far enough for the cream to reach every corner.
740
+ const reach = Math.hypot(Math.max(center.x, width - center.x), Math.max(center.y, height - center.y)) + 24;
741
+
742
+ const c = useMemo(() => {
743
+ const toPaper: Key[] = [
744
+ [POWER_ON.paper, 1],
745
+ [POWER_ON.paper + 560, 0, IN_OUT],
746
+ ];
747
+ const minuteLength = curve(t, [
748
+ [POWER_ON.click, 0.55],
749
+ [POWER_ON.click + 240, 1, OUT],
750
+ ]);
751
+ const hourLength = curve(t, [
752
+ [1700, 0.001],
753
+ [2220, 1, OUT],
754
+ ]);
755
+ const [b0, b1] = POWER_ON.beats;
756
+ return {
757
+ dimOut: curve(t, toPaper),
758
+ inkIn: curve(t, [
759
+ [POWER_ON.paper, 0],
760
+ [POWER_ON.paper + 560, 1, IN_OUT],
761
+ ]),
762
+ lit: TICKS.map((i) => {
763
+ const at = tickLitAt(i);
764
+ return curve(t, [[at, 0], [at + 140, 1, OUT], ...toPaper]);
765
+ }),
766
+ flash: curve(t, [
767
+ [POWER_ON.click, 0],
768
+ [POWER_ON.click + 50, 1],
769
+ [POWER_ON.click + 340, 0, OUT],
770
+ ]),
771
+ minuteShow: curve(t, [
772
+ [POWER_ON.click, 0],
773
+ [POWER_ON.click + 90, 1],
774
+ ]),
775
+ minuteAngle: curve(t, [
776
+ [POWER_ON.click, -32],
777
+ [POWER_ON.click + 240, 0, SNAP],
778
+ [POWER_ON.settle, 0],
779
+ [POWER_ON.settle + 620, 60, IN_OUT],
780
+ ]).interpolate({ inputRange: [-360, 360], outputRange: ['-360deg', '360deg'] }),
781
+ minuteLength,
782
+ minuteFromPin: fromPin(minuteLength, minute),
783
+ hourShow: curve(t, [
784
+ [1700, 0],
785
+ [1760, 1],
786
+ ]),
787
+ hourLength,
788
+ hourFromPin: fromPin(hourLength, hour),
789
+ pin: curve(t, [
790
+ [1780, 0],
791
+ [2020, 1, OUT],
792
+ ]),
793
+ cream: curve(t, [
794
+ [1020, 0.001],
795
+ [1660, (reach * 2) / PO_CREAM, OUT],
796
+ ]),
797
+ glowShow: curve(t, [
798
+ [POWER_ON.ignite, 0],
799
+ [1225, 1, OUT],
800
+ [1600, 0.55, IN_OUT],
801
+ [2100, 0, IN_OUT],
802
+ ]),
803
+ glowScale: curve(t, [
804
+ [POWER_ON.ignite, 0.4],
805
+ [1225, 1.15, OUT],
806
+ [1900, 1, IN_OUT],
807
+ ]),
808
+ flashShow: curve(t, [
809
+ [POWER_ON.ignite, 0],
810
+ [1050, 0.85, OUT],
811
+ [1300, 0, IN_OUT],
812
+ ]),
813
+ markShow: curve(t, [
814
+ [POWER_ON.ignite, 0],
815
+ [1180, 1, OUT],
816
+ [POWER_ON.sink, 1],
817
+ [POWER_ON.sink + 380, 0, IN],
818
+ ]),
819
+ markScale: curve(t, [
820
+ [POWER_ON.ignite, 0.3],
821
+ [1180, 1.15, OUT],
822
+ [b0, 1, IN_OUT],
823
+ [b0 + 88, 1.08, IN_OUT],
824
+ [b1, 1, IN_OUT],
825
+ [b1 + 80, 1.04, IN_OUT],
826
+ [POWER_ON.sink, 1, IN_OUT],
827
+ [POWER_ON.sink + 380, 0.07, IN],
828
+ ]),
829
+ rings: [
830
+ ring(t, POWER_ON.ignite, 780, 0.9, 0.7, 4.4),
831
+ ring(t, b0, 620, 0.5, 0.95, 2.1),
832
+ ring(t, b1, 560, 0.32, 0.95, 1.7),
833
+ ],
834
+ };
835
+ }, [hour, minute, reach, t]);
836
+
837
+ return (
838
+ <Pressable
839
+ style={StyleSheet.absoluteFill}
840
+ onPress={() => {
841
+ t.stopAnimation();
842
+ done.current();
843
+ }}
844
+ accessibilityRole="button"
845
+ accessibilityLabel="Skip the intro"
846
+ >
847
+ <StatusBar barStyle={dark ? 'light-content' : 'dark-content'} animated />
848
+ <View style={[StyleSheet.absoluteFill, { backgroundColor: INK_BG }]} />
849
+ <Animated.View
850
+ pointerEvents="none"
851
+ style={[
852
+ s.poCream,
853
+ { left: center.x - PO_CREAM / 2, top: center.y - PO_CREAM / 2, transform: [{ scale: c.cream }] },
854
+ ]}
855
+ />
856
+ {/* The clock, Dial's own: dim ticks lighting orange, then all of it turning to ink with the cream. */}
857
+ <View
858
+ pointerEvents="none"
859
+ {...hidden}
860
+ style={{ position: 'absolute', left: center.x - r, top: center.y - r, width: size, height: size }}
861
+ >
862
+ <Animated.View style={[StyleSheet.absoluteFill, s.poRim, { borderRadius: r, opacity: c.dimOut }]} />
863
+ <Animated.View style={[StyleSheet.absoluteFill, s.poRimPaper, { borderRadius: r, opacity: c.inkIn }]} />
864
+ <Animated.View style={[StyleSheet.absoluteFill, { opacity: c.dimOut }]}>
865
+ {TICKS.map((i) => (
866
+ <View key={i} style={[StyleSheet.absoluteFill, { transform: [{ rotate: `${i * 6}deg` }] }]}>
867
+ <View
868
+ style={[i % 5 === 0 ? s.tickMajor : s.tick, i % 5 === 0 ? s.tickMajorDim : s.tickDim]}
869
+ />
870
+ </View>
871
+ ))}
872
+ </Animated.View>
873
+ <Animated.View style={[StyleSheet.absoluteFill, { opacity: c.inkIn }]}>
874
+ {TICKS.map((i) => (
875
+ <View key={i} style={[StyleSheet.absoluteFill, { transform: [{ rotate: `${i * 6}deg` }] }]}>
876
+ <View style={i % 5 === 0 ? s.tickMajor : s.tick} />
877
+ </View>
878
+ ))}
879
+ </Animated.View>
880
+ {TICKS.map((i) => (
881
+ <Animated.View
882
+ key={`lit${i}`}
883
+ style={[StyleSheet.absoluteFill, { opacity: c.lit[i], transform: [{ rotate: `${i * 6}deg` }] }]}
884
+ >
885
+ <View style={[i % 5 === 0 ? s.tickMajor : s.tick, i % 5 === 0 ? s.tickMajorLit : s.tickLit]} />
886
+ </Animated.View>
887
+ ))}
888
+ <Animated.View
889
+ style={[StyleSheet.absoluteFill, s.poFlashRing, { borderRadius: r, opacity: c.flash }]}
890
+ />
891
+ <Animated.View
892
+ style={[StyleSheet.absoluteFill, { opacity: c.hourShow, transform: [{ rotate: '-60deg' }] }]}
893
+ >
894
+ <Animated.View
895
+ style={[
896
+ s.hand,
897
+ { left: r - 2.5, top: r - hour, width: 5, height: hour, borderRadius: 2.5 },
898
+ { transform: [{ translateY: c.hourFromPin }, { scaleY: c.hourLength }] },
899
+ ]}
900
+ />
901
+ </Animated.View>
902
+ <Animated.View
903
+ style={[StyleSheet.absoluteFill, { opacity: c.minuteShow, transform: [{ rotate: c.minuteAngle }] }]}
904
+ >
905
+ <Animated.View
906
+ style={{
907
+ position: 'absolute',
908
+ left: r - 1.5,
909
+ top: r - minute,
910
+ width: 3,
911
+ height: minute,
912
+ transform: [{ translateY: c.minuteFromPin }, { scaleY: c.minuteLength }],
913
+ }}
914
+ >
915
+ <Animated.View style={[StyleSheet.absoluteFill, s.poEmberHand, { opacity: c.dimOut }]} />
916
+ <Animated.View style={[StyleSheet.absoluteFill, s.poInkHand, { opacity: c.inkIn }]} />
917
+ </Animated.View>
918
+ </Animated.View>
919
+ <Animated.View style={[s.pin, { left: r - 6.5, top: r - 6.5, opacity: c.pin }]} />
920
+ </View>
921
+ {/* Lucy lighting up: her glow, the shockwave and her two heartbeat rings, the mark, and a white flash. */}
922
+ <Animated.View
923
+ pointerEvents="none"
924
+ {...hidden}
925
+ style={{
926
+ position: 'absolute',
927
+ left: center.x - PO_GLOW / 2,
928
+ top: center.y - PO_GLOW / 2,
929
+ width: PO_GLOW,
930
+ height: PO_GLOW,
931
+ opacity: c.glowShow,
932
+ transform: [{ scale: c.glowScale }],
933
+ }}
934
+ >
935
+ <Svg width={PO_GLOW} height={PO_GLOW}>
936
+ <Defs>
937
+ <RadialGradient id={glowId} cx="50%" cy="50%" r="50%">
938
+ <Stop offset="0" stopColor="#FF8A3D" stopOpacity={0.85} />
939
+ <Stop offset="0.45" stopColor="#FF5A00" stopOpacity={0.28} />
940
+ <Stop offset="1" stopColor="#FF5A00" stopOpacity={0} />
941
+ </RadialGradient>
942
+ </Defs>
943
+ <Circle cx={PO_GLOW / 2} cy={PO_GLOW / 2} r={PO_GLOW / 2} fill={`url(#${glowId})`} />
944
+ </Svg>
945
+ </Animated.View>
946
+ {c.rings.map((wave, n) => (
947
+ <Animated.View
948
+ key={n}
949
+ pointerEvents="none"
950
+ style={[
951
+ s.poRing,
952
+ {
953
+ left: center.x - PO_MARK / 2,
954
+ top: center.y - PO_MARK / 2,
955
+ opacity: wave.opacity,
956
+ transform: [{ scale: wave.scale }],
957
+ },
958
+ ]}
959
+ />
960
+ ))}
961
+ <Animated.View
962
+ pointerEvents="none"
963
+ {...hidden}
964
+ style={{
965
+ position: 'absolute',
966
+ left: center.x - PO_MARK / 2,
967
+ top: center.y - PO_MARK / 2,
968
+ opacity: c.markShow,
969
+ transform: [{ scale: c.markScale }],
970
+ }}
971
+ >
972
+ <Mark size={PO_MARK} />
973
+ </Animated.View>
974
+ <Animated.View
975
+ pointerEvents="none"
976
+ {...hidden}
977
+ style={{
978
+ position: 'absolute',
979
+ left: center.x - PO_FLASH / 2,
980
+ top: center.y - PO_FLASH / 2,
981
+ width: PO_FLASH,
982
+ height: PO_FLASH,
983
+ opacity: c.flashShow,
984
+ }}
985
+ >
986
+ <Svg width={PO_FLASH} height={PO_FLASH}>
987
+ <Defs>
988
+ <RadialGradient id={flashId} cx="50%" cy="50%" r="50%">
989
+ <Stop offset="0" stopColor="#FFFFFF" stopOpacity={0.9} />
990
+ <Stop offset="1" stopColor="#FFFFFF" stopOpacity={0} />
991
+ </RadialGradient>
992
+ </Defs>
993
+ <Circle cx={PO_FLASH / 2} cy={PO_FLASH / 2} r={PO_FLASH / 2} fill={`url(#${flashId})`} />
994
+ </Svg>
995
+ </Animated.View>
996
+ </Pressable>
997
+ );
998
+ }
999
+
1000
+ /* ---------------------------------------------------------------------------------------------- buttons */
1001
+
1002
+ /**
1003
+ * The main button: ink, with an ember glowing up from its bottom edge (`orange` is the free week's: orange, ink
1004
+ * text). Disabled, the ember dims.
1005
+ */
1006
+ export function GlowButton({
1007
+ label,
1008
+ onPress,
1009
+ disabled = false,
1010
+ busy = false,
1011
+ icon,
1012
+ variant = 'ink',
1013
+ style,
1014
+ }: {
1015
+ label: string;
1016
+ onPress: () => void;
1017
+ disabled?: boolean;
1018
+ busy?: boolean;
1019
+ icon?: IconName;
1020
+ variant?: 'ink' | 'orange';
1021
+ style?: StyleProp<ViewStyle>;
1022
+ }) {
1023
+ const gold = useSvgId('gold');
1024
+ const ember = useSvgId('ember');
1025
+ const coral = useSvgId('coral');
1026
+ const fill = useSvgId('fill');
1027
+ const ink = variant === 'ink';
1028
+ const text = ink ? '#FFFAF5' : ui.ink;
1029
+ return (
1030
+ <Pressable
1031
+ onPress={() => pressed(onPress)}
1032
+ disabled={disabled || busy}
1033
+ accessibilityRole="button"
1034
+ accessibilityLabel={label}
1035
+ accessibilityState={{ disabled, busy }}
1036
+ style={({ pressed }) => [s.btn, ink ? s.btnInk : s.btnOrange, style, pressed && s.pressed]}
1037
+ >
1038
+ <View pointerEvents="none" style={[StyleSheet.absoluteFill, s.btnClip]}>
1039
+ <Svg width="100%" height="100%" viewBox="0 0 350 58" preserveAspectRatio="none">
1040
+ <Defs>
1041
+ {ink ? (
1042
+ <>
1043
+ <RadialGradient id={gold} cx="28%" cy="118%" r="52%">
1044
+ <Stop offset="0" stopColor="#FFC66E" stopOpacity={0.95} />
1045
+ <Stop offset="1" stopColor="#FFC66E" stopOpacity={0} />
1046
+ </RadialGradient>
1047
+ <RadialGradient id={ember} cx="52%" cy="122%" r="58%">
1048
+ <Stop offset="0" stopColor="#FF5A00" stopOpacity={1} />
1049
+ <Stop offset="1" stopColor="#FF5A00" stopOpacity={0} />
1050
+ </RadialGradient>
1051
+ <RadialGradient id={coral} cx="78%" cy="118%" r="46%">
1052
+ <Stop offset="0" stopColor="#FF4F6B" stopOpacity={0.85} />
1053
+ <Stop offset="1" stopColor="#FF4F6B" stopOpacity={0} />
1054
+ </RadialGradient>
1055
+ </>
1056
+ ) : (
1057
+ <LinearGradient id={fill} x1="0" y1="0" x2="0" y2="1">
1058
+ <Stop offset="0" stopColor="#FF9B50" />
1059
+ <Stop offset="0.55" stopColor="#FF6A14" />
1060
+ <Stop offset="1" stopColor="#FF5A00" />
1061
+ </LinearGradient>
1062
+ )}
1063
+ </Defs>
1064
+ {ink ? (
1065
+ <>
1066
+ <Rect width="350" height="58" fill={`url(#${gold})`} opacity={disabled ? 0.3 : 1} />
1067
+ <Rect width="350" height="58" fill={`url(#${ember})`} opacity={disabled ? 0.3 : 1} />
1068
+ <Rect width="350" height="58" fill={`url(#${coral})`} opacity={disabled ? 0.3 : 1} />
1069
+ </>
1070
+ ) : (
1071
+ <Rect width="350" height="58" fill={`url(#${fill})`} />
1072
+ )}
1073
+ </Svg>
1074
+ </View>
1075
+ {busy ? <ActivityIndicator color={text} /> : icon ? <Ionicons name={icon} size={18} color={text} /> : null}
1076
+ <Text style={[s.btnLabel, { color: text }, disabled && s.btnLabelOff]}>{label}</Text>
1077
+ </Pressable>
1078
+ );
1079
+ }
1080
+
1081
+ /** A quieter button: white on the cream page. */
1082
+ export function SoftButton({
1083
+ label,
1084
+ onPress,
1085
+ icon,
1086
+ busy = false,
1087
+ style,
1088
+ }: {
1089
+ label: string;
1090
+ onPress: () => void;
1091
+ icon?: IconName;
1092
+ busy?: boolean;
1093
+ style?: StyleProp<ViewStyle>;
1094
+ }) {
1095
+ return (
1096
+ <Pressable
1097
+ onPress={() => pressed(onPress)}
1098
+ disabled={busy}
1099
+ accessibilityRole="button"
1100
+ accessibilityLabel={label}
1101
+ accessibilityState={{ busy }}
1102
+ style={({ pressed }) => [s.soft, style, pressed && s.pressed]}
1103
+ >
1104
+ {busy ? (
1105
+ <ActivityIndicator color={ui.ink} />
1106
+ ) : icon ? (
1107
+ <Ionicons name={icon} size={18} color={ui.accentText} />
1108
+ ) : null}
1109
+ <Text style={s.softLabel}>{label}</Text>
1110
+ </Pressable>
1111
+ );
1112
+ }
1113
+
1114
+ /** Text that is a button. */
1115
+ export function LinkButton({
1116
+ label,
1117
+ onPress,
1118
+ icon,
1119
+ style,
1120
+ }: {
1121
+ label: string;
1122
+ onPress: () => void;
1123
+ icon?: IconName;
1124
+ style?: StyleProp<ViewStyle>;
1125
+ }) {
1126
+ return (
1127
+ <Pressable
1128
+ onPress={() => pressed(onPress)}
1129
+ hitSlop={8}
1130
+ accessibilityRole="button"
1131
+ accessibilityLabel={label}
1132
+ style={({ pressed }) => [s.link, style, pressed && { opacity: 0.6 }]}
1133
+ >
1134
+ {icon ? <Ionicons name={icon} size={16} color={ui.muted} /> : null}
1135
+ <Text style={s.linkLabel}>{label}</Text>
1136
+ </Pressable>
1137
+ );
1138
+ }
1139
+
1140
+ /* ---------------------------------------------------------------------------------------------- choices */
1141
+
1142
+ export function OptionRow({
1143
+ label,
1144
+ icon,
1145
+ selected,
1146
+ onPress,
1147
+ delay,
1148
+ still,
1149
+ }: {
1150
+ label: string;
1151
+ icon?: IconName;
1152
+ selected: boolean;
1153
+ onPress: () => void;
1154
+ delay: number;
1155
+ still: boolean;
1156
+ }) {
1157
+ return (
1158
+ <Reveal delay={delay} still={still} rise={18}>
1159
+ <Pressable
1160
+ onPress={() => pressed(onPress)}
1161
+ accessibilityRole="button"
1162
+ accessibilityLabel={label}
1163
+ accessibilityState={{ selected }}
1164
+ style={({ pressed }) => [s.opt, selected && s.optOn, pressed && s.pressed]}
1165
+ >
1166
+ {icon ? (
1167
+ <View style={s.optIcon}>
1168
+ <Ionicons name={icon} size={19} color={ui.accentText} />
1169
+ </View>
1170
+ ) : null}
1171
+ <Text style={[s.optLabel, !icon && s.optLabelPlain]}>{label}</Text>
1172
+ <View style={[s.optCheck, selected && s.optCheckOn]}>
1173
+ {selected ? <Ionicons name="checkmark" size={14} color={ui.ink} /> : null}
1174
+ </View>
1175
+ </Pressable>
1176
+ </Reveal>
1177
+ );
1178
+ }
1179
+
1180
+ export function NumberChip({
1181
+ label,
1182
+ a11y,
1183
+ selected,
1184
+ onPress,
1185
+ delay,
1186
+ still,
1187
+ }: {
1188
+ label: string;
1189
+ a11y: string;
1190
+ selected: boolean;
1191
+ onPress: () => void;
1192
+ delay: number;
1193
+ still: boolean;
1194
+ }) {
1195
+ return (
1196
+ <Reveal delay={delay} still={still} rise={18}>
1197
+ <Pressable
1198
+ onPress={() => pressed(onPress)}
1199
+ accessibilityRole="button"
1200
+ accessibilityLabel={a11y}
1201
+ accessibilityState={{ selected }}
1202
+ style={({ pressed }) => [s.num, selected && s.numOn, pressed && s.pressedSmall]}
1203
+ >
1204
+ <Text style={[s.numLabel, selected && s.numLabelOn]}>{label}</Text>
1205
+ </Pressable>
1206
+ </Reveal>
1207
+ );
1208
+ }
1209
+
1210
+ /** The "Adding it up" bar. */
1211
+ export function FillBar({ delay, duration, still }: { delay: number; duration: number; still: boolean }) {
1212
+ const v = useRef(new Animated.Value(still ? 1 : 0)).current;
1213
+ const id = useSvgId('bar');
1214
+ useEffect(() => {
1215
+ if (still) {
1216
+ v.setValue(1);
1217
+ return undefined;
1218
+ }
1219
+ const anim = Animated.timing(v, {
1220
+ toValue: 1,
1221
+ duration,
1222
+ delay,
1223
+ easing: Easing.bezier(0.45, 0.05, 0.25, 1),
1224
+ useNativeDriver: true,
1225
+ });
1226
+ anim.start();
1227
+ return () => anim.stop();
1228
+ }, [delay, duration, still, v]);
1229
+ return (
1230
+ <View style={s.track} accessibilityRole="progressbar" accessibilityLabel="Adding it up">
1231
+ <Animated.View style={[s.trackFill, { transformOrigin: 'left', transform: [{ scaleX: v }] }]}>
1232
+ <Svg width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 100 6">
1233
+ <Defs>
1234
+ <LinearGradient id={id} x1="0" y1="0" x2="1" y2="0">
1235
+ <Stop offset="0" stopColor="#FFC66E" />
1236
+ <Stop offset="0.45" stopColor="#FF8A3D" />
1237
+ <Stop offset="1" stopColor="#FF5A00" />
1238
+ </LinearGradient>
1239
+ </Defs>
1240
+ <Rect width="100" height="6" fill={`url(#${id})`} />
1241
+ </Svg>
1242
+ </Animated.View>
1243
+ </View>
1244
+ );
1245
+ }
1246
+
1247
+ /* ---------------------------------------------------------------------------------------------- the numbers */
1248
+
1249
+ const ROW = 100;
1250
+
1251
+ /** The years rolling up to the answer, its neighbours fading once it lands. */
1252
+ /** The years' reel: quick, then a long settle. Its haptic ticks follow the same curve. */
1253
+ const ROLL_EASE = Easing.bezier(0.14, 0.8, 0.22, 1);
1254
+
1255
+ export function Roller({ years, still }: { years: number; still: boolean }) {
1256
+ const { rows, target } = rollRows(years);
1257
+ const end = -(target - 1) * ROW;
1258
+ const y = useRef(new Animated.Value(still ? end : ROW)).current;
1259
+ const settle = useRef(new Animated.Value(still ? 1 : 0)).current;
1260
+ useEffect(() => {
1261
+ if (still) {
1262
+ y.setValue(end);
1263
+ settle.setValue(1);
1264
+ return undefined;
1265
+ }
1266
+ const anim = Animated.sequence([
1267
+ Animated.delay(1300),
1268
+ Animated.timing(y, {
1269
+ toValue: end,
1270
+ duration: 2400,
1271
+ easing: ROLL_EASE,
1272
+ useNativeDriver: true,
1273
+ }),
1274
+ Animated.timing(settle, { toValue: 1, duration: 700, easing: EASE, useNativeDriver: true }),
1275
+ ]);
1276
+ anim.start();
1277
+ // Felt as the reel turns, a tick for each year it passes, slowing with it, then a thud as the years land.
1278
+ const passing = reel(target, 2400, 1300, ROLL_EASE);
1279
+ const landed = setTimeout(thud, 3600);
1280
+ return () => {
1281
+ anim.stop();
1282
+ passing();
1283
+ clearTimeout(landed);
1284
+ };
1285
+ }, [end, settle, still, target, y]);
1286
+ const fadeOut = settle.interpolate({ inputRange: [0, 1], outputRange: [1, 0] });
1287
+ return (
1288
+ <View style={s.rollWindow} accessible accessibilityRole="text" accessibilityLabel={yearsLabel(years)}>
1289
+ <Animated.View style={{ transform: [{ translateY: y }] }} {...hidden}>
1290
+ {rows.map((n, i) => {
1291
+ // Brightest in the middle of the window, fading towards its edges as the strip rolls past.
1292
+ const centred = (1 - i) * ROW;
1293
+ const near = y.interpolate({
1294
+ inputRange: [centred - ROW * 1.5, centred, centred + ROW * 1.5],
1295
+ outputRange: [0, 1, 0],
1296
+ extrapolate: 'clamp',
1297
+ });
1298
+ return (
1299
+ <Animated.Text
1300
+ key={n}
1301
+ style={[s.rollRow, { opacity: i === target ? near : Animated.multiply(near, fadeOut) }]}
1302
+ >
1303
+ {yearsLabel(n)}
1304
+ </Animated.Text>
1305
+ );
1306
+ })}
1307
+ </Animated.View>
1308
+ </View>
1309
+ );
1310
+ }
1311
+
1312
+ /** Room above and below the digits, so a numeral's top is never clipped by its window. */
1313
+ const DIGIT = 132;
1314
+
1315
+ /** The odometer's wheels start this long after it appears... */
1316
+ const ODO_START = 950;
1317
+ /** ...wheel `col` turns for this long, each further right turning longer... */
1318
+ const odoTurn = (col: number) => 1700 + col * 420;
1319
+ /** ...and it locks (its thud) as it all but stops, the eased last 100 ms being too slow to see. */
1320
+ const odoLock = (col: number) => ODO_START + odoTurn(col) - 100;
1321
+
1322
+ function OdoColumn({ digits, stop, col, still }: { digits: number[]; stop: number; col: number; still: boolean }) {
1323
+ const y = useRef(new Animated.Value(still ? -stop * DIGIT : 0)).current;
1324
+ useEffect(() => {
1325
+ if (still) {
1326
+ y.setValue(-stop * DIGIT);
1327
+ return undefined;
1328
+ }
1329
+ const anim = Animated.timing(y, {
1330
+ toValue: -stop * DIGIT,
1331
+ duration: odoTurn(col),
1332
+ delay: ODO_START,
1333
+ easing: Easing.bezier(0.16, 0.84, 0.2, 1),
1334
+ useNativeDriver: true,
1335
+ });
1336
+ anim.start();
1337
+ // Each digit locks into place with a thud, like an odometer's wheels.
1338
+ const locked = setTimeout(thud, odoLock(col));
1339
+ return () => {
1340
+ anim.stop();
1341
+ clearTimeout(locked);
1342
+ };
1343
+ }, [col, still, stop, y]);
1344
+ return (
1345
+ <View style={s.odoCol}>
1346
+ <Animated.View style={{ transform: [{ translateY: y }] }}>
1347
+ {digits.map((d, k) => (
1348
+ <Text key={k} style={s.odoDigit}>
1349
+ {d}
1350
+ </Text>
1351
+ ))}
1352
+ </Animated.View>
1353
+ </View>
1354
+ );
1355
+ }
1356
+
1357
+ /** The hours back, counted up like an odometer (each digit further right spins more). */
1358
+ export function Odometer({ value, still }: { value: number; still: boolean }) {
1359
+ const cols = odometerColumns(value);
1360
+ // The last wheel locking is the good news landing: heard as the hours back (sound.ts).
1361
+ const last = cols.length - 1;
1362
+ useEffect(() => {
1363
+ if (still) return undefined;
1364
+ const landed = setTimeout(() => play('hoursBack'), odoLock(last));
1365
+ return () => clearTimeout(landed);
1366
+ }, [last, still]);
1367
+ return (
1368
+ <View style={s.odoRow} accessible accessibilityRole="text" accessibilityLabel={`${value} hours`}>
1369
+ <View style={s.odoNum} {...hidden}>
1370
+ {cols.map((c, i) => (
1371
+ <OdoColumn key={i} digits={c.digits} stop={c.stop} col={i} still={still} />
1372
+ ))}
1373
+ </View>
1374
+ <Text style={s.odoUnit} {...hidden}>
1375
+ hours
1376
+ </Text>
1377
+ </View>
1378
+ );
1379
+ }
1380
+
1381
+ /* ---------------------------------------------------------------------------------------------- previews */
1382
+
1383
+ /** A glowing frame round a preview of what is coming (a system prompt, a connection), breathing gently. */
1384
+ export function PrimeFrame({ still, children }: { still: boolean; children: React.ReactNode }) {
1385
+ const pulse = useRef(new Animated.Value(0)).current;
1386
+ useEffect(() => {
1387
+ if (still) return undefined;
1388
+ const loop = Animated.loop(
1389
+ Animated.sequence([
1390
+ Animated.timing(pulse, {
1391
+ toValue: 1,
1392
+ duration: 1600,
1393
+ easing: Easing.inOut(Easing.sin),
1394
+ useNativeDriver: true,
1395
+ }),
1396
+ Animated.timing(pulse, {
1397
+ toValue: 0,
1398
+ duration: 1600,
1399
+ easing: Easing.inOut(Easing.sin),
1400
+ useNativeDriver: true,
1401
+ }),
1402
+ ]),
1403
+ );
1404
+ loop.start();
1405
+ return () => loop.stop();
1406
+ }, [pulse, still]);
1407
+ return (
1408
+ <View style={s.frameWrap}>
1409
+ <Animated.View
1410
+ pointerEvents="none"
1411
+ style={[
1412
+ StyleSheet.absoluteFill,
1413
+ s.frameGlow,
1414
+ { opacity: pulse.interpolate({ inputRange: [0, 1], outputRange: [0.6, 1] }) },
1415
+ ]}
1416
+ />
1417
+ <View style={s.frame}>{children}</View>
1418
+ </View>
1419
+ );
1420
+ }
1421
+
1422
+ /** How the phone's own prompt will look, drawn so it can be explained before it shows. */
1423
+ export function SystemPrompt({
1424
+ title,
1425
+ body,
1426
+ deny,
1427
+ allow,
1428
+ onDeny,
1429
+ onAllow,
1430
+ }: {
1431
+ title: string;
1432
+ body: string;
1433
+ deny: string;
1434
+ allow: string;
1435
+ onDeny: () => void;
1436
+ onAllow: () => void;
1437
+ }) {
1438
+ return (
1439
+ <View style={s.alert}>
1440
+ <Text style={s.alertTitle}>{title}</Text>
1441
+ <Text style={s.alertBody}>{body}</Text>
1442
+ <View style={s.alertButtons}>
1443
+ <Pressable
1444
+ onPress={() => pressed(onDeny)}
1445
+ accessibilityRole="button"
1446
+ accessibilityLabel={deny}
1447
+ style={({ pressed }) => [s.alertBtn, pressed && s.pressed]}
1448
+ >
1449
+ <Text style={s.alertBtnLabel}>{deny}</Text>
1450
+ </Pressable>
1451
+ <Pressable
1452
+ onPress={() => pressed(onAllow)}
1453
+ accessibilityRole="button"
1454
+ accessibilityLabel={allow}
1455
+ style={({ pressed }) => [s.alertBtn, s.alertBtnYes, pressed && s.pressed]}
1456
+ >
1457
+ <Text style={[s.alertBtnLabel, s.alertBtnLabelYes]}>{allow}</Text>
1458
+ </Pressable>
1459
+ </View>
1460
+ </View>
1461
+ );
1462
+ }
1463
+
1464
+ /** A hand-drawn arrow up to what to tap, drawn in once the frame has arrived. */
1465
+ export function DrawnArrow({ delay = 1000, still }: { delay?: number; still: boolean }) {
1466
+ const d = useRef(new Animated.Value(still ? 0 : 1)).current;
1467
+ useEffect(() => {
1468
+ if (still) {
1469
+ d.setValue(0);
1470
+ return undefined;
1471
+ }
1472
+ const anim = Animated.timing(d, {
1473
+ toValue: 0,
1474
+ duration: 900,
1475
+ delay,
1476
+ easing: Easing.bezier(0.5, 0, 0.2, 1),
1477
+ useNativeDriver: false,
1478
+ });
1479
+ anim.start();
1480
+ return () => anim.stop();
1481
+ }, [d, delay, still]);
1482
+ return (
1483
+ <View style={s.arrow} {...hidden}>
1484
+ <Svg width={120} height={104} viewBox="0 0 120 104">
1485
+ <AnimatedPath
1486
+ d="M24 100 C 20 66 40 32 76 8"
1487
+ fill="none"
1488
+ stroke={ui.accent}
1489
+ strokeWidth={2.2}
1490
+ strokeLinecap="round"
1491
+ strokeDasharray="140"
1492
+ strokeDashoffset={d.interpolate({ inputRange: [0, 1], outputRange: [0, 140] })}
1493
+ />
1494
+ <AnimatedPath
1495
+ d="M61 9 L 76 8 L 69 21"
1496
+ fill="none"
1497
+ stroke={ui.accent}
1498
+ strokeWidth={2.2}
1499
+ strokeLinecap="round"
1500
+ strokeLinejoin="round"
1501
+ opacity={d.interpolate({ inputRange: [0, 0.12, 1], outputRange: [1, 0, 0] })}
1502
+ />
1503
+ </Svg>
1504
+ </View>
1505
+ );
1506
+ }
1507
+
1508
+ /* ---------------------------------------------------------------------------------------------- the burst */
1509
+
1510
+ const BURST_ICONS: IconName[] = [
1511
+ 'time-outline',
1512
+ 'call-outline',
1513
+ 'receipt-outline',
1514
+ 'calendar-outline',
1515
+ 'cart-outline',
1516
+ 'airplane-outline',
1517
+ 'sparkles-outline',
1518
+ 'checkmark-circle-outline',
1519
+ ];
1520
+ const BURST_COLORS = ['#FF8A3D', '#F0A040', ui.accentText, ui.accent];
1521
+ const PARTS = Array.from({ length: 26 }, (_, i) => {
1522
+ const angle = ((i * (360 / 26) + ((i * 37) % 11) - 5) * Math.PI) / 180;
1523
+ const dist = [122, 176, 236][i % 3];
1524
+ return {
1525
+ x: Math.sin(angle) * dist,
1526
+ y: -Math.cos(angle) * dist,
1527
+ icon: i % 2 === 0 ? BURST_ICONS[Math.floor(i / 2) % BURST_ICONS.length] : null,
1528
+ sliver: i % 4 === 3,
1529
+ color: BURST_COLORS[(i * 3) % 4],
1530
+ spin: i % 2 === 0 ? -140 : 120,
1531
+ };
1532
+ });
1533
+
1534
+ /** Lucy's icons thrown out from the orb, two rings rippling after them, then all of it settling away. */
1535
+ export function Burst({ centerY, still }: { centerY: number; still: boolean }) {
1536
+ const p = useRef(new Animated.Value(still ? 1 : 0)).current;
1537
+ const fade = useRef(new Animated.Value(1)).current;
1538
+ const ring1 = useRef(new Animated.Value(still ? 1 : 0)).current;
1539
+ const ring2 = useRef(new Animated.Value(still ? 1 : 0)).current;
1540
+ useEffect(() => {
1541
+ if (still) return undefined;
1542
+ const ring = (v: Animated.Value, delay: number) =>
1543
+ Animated.timing(v, {
1544
+ toValue: 1,
1545
+ duration: 1500,
1546
+ delay,
1547
+ easing: Easing.bezier(0.2, 0.7, 0.3, 1),
1548
+ useNativeDriver: true,
1549
+ });
1550
+ const anim = Animated.parallel([
1551
+ Animated.timing(p, {
1552
+ toValue: 1,
1553
+ duration: 1300,
1554
+ easing: Easing.bezier(0.12, 0.82, 0.25, 1),
1555
+ useNativeDriver: true,
1556
+ }),
1557
+ Animated.sequence([
1558
+ Animated.delay(1750),
1559
+ Animated.timing(fade, { toValue: 0, duration: 900, useNativeDriver: true }),
1560
+ ]),
1561
+ ring(ring1, 200),
1562
+ ring(ring2, 500),
1563
+ ]);
1564
+ anim.start();
1565
+ success();
1566
+ // Heard as the icons fly (sound.ts), left to ring out as the welcome moves on.
1567
+ play('youreIn');
1568
+ return () => anim.stop();
1569
+ }, [fade, p, ring1, ring2, still]);
1570
+ const shown = Animated.multiply(
1571
+ p.interpolate({ inputRange: [0, 0.18], outputRange: [0, 1], extrapolate: 'clamp' }),
1572
+ fade,
1573
+ );
1574
+ const ringStyle = (v: Animated.Value) => ({
1575
+ opacity: v.interpolate({ inputRange: [0, 1], outputRange: [0.95, 0] }),
1576
+ transform: [{ scale: v.interpolate({ inputRange: [0, 1], outputRange: [0.4, 3.4] }) }],
1577
+ });
1578
+ return (
1579
+ <View pointerEvents="none" style={[s.burst, { top: centerY }]} {...hidden}>
1580
+ <Animated.View style={[s.ring, ringStyle(ring1)]} />
1581
+ <Animated.View style={[s.ring, ringStyle(ring2)]} />
1582
+ {PARTS.map((part, i) => (
1583
+ <Animated.View
1584
+ key={i}
1585
+ style={[
1586
+ s.part,
1587
+ {
1588
+ opacity: shown,
1589
+ transform: [
1590
+ { translateX: p.interpolate({ inputRange: [0, 1], outputRange: [0, part.x] }) },
1591
+ { translateY: p.interpolate({ inputRange: [0, 1], outputRange: [0, part.y] }) },
1592
+ {
1593
+ rotate: p.interpolate({
1594
+ inputRange: [0, 1],
1595
+ outputRange: [`${part.spin}deg`, '0deg'],
1596
+ }),
1597
+ },
1598
+ { scale: p.interpolate({ inputRange: [0, 1], outputRange: [0.2, 1] }) },
1599
+ ],
1600
+ },
1601
+ ]}
1602
+ >
1603
+ {part.icon ? (
1604
+ <Ionicons name={part.icon} size={21} color={part.color} />
1605
+ ) : (
1606
+ <View style={[part.sliver ? s.sliver : s.dot, { backgroundColor: part.color }]} />
1607
+ )}
1608
+ </Animated.View>
1609
+ ))}
1610
+ </View>
1611
+ );
1612
+ }
1613
+
1614
+ /* ---------------------------------------------------------------------------------------------- the sunset */
1615
+
1616
+ /** An evening coming back: a warm sky, the sun setting with the clock's hands on it, birds and hills, into cream. */
1617
+ export function Sunset({ width, height, still }: { width: number; height: number; still: boolean }) {
1618
+ const sky = useSvgId('sky');
1619
+ const sun = useSvgId('sun');
1620
+ const sunGlow = useSvgId('sunGlow');
1621
+ const fadeId = useSvgId('fade');
1622
+ const rise = useRef(new Animated.Value(still ? 1 : 0)).current;
1623
+ const drift = useRef(new Animated.Value(0)).current;
1624
+ useEffect(() => {
1625
+ if (still) return undefined;
1626
+ const anim = Animated.timing(rise, { toValue: 1, duration: 2400, easing: EASE, useNativeDriver: true });
1627
+ const loop = Animated.loop(
1628
+ Animated.sequence([
1629
+ Animated.timing(drift, {
1630
+ toValue: 1,
1631
+ duration: 14000,
1632
+ easing: Easing.inOut(Easing.sin),
1633
+ useNativeDriver: true,
1634
+ }),
1635
+ Animated.timing(drift, {
1636
+ toValue: 0,
1637
+ duration: 14000,
1638
+ easing: Easing.inOut(Easing.sin),
1639
+ useNativeDriver: true,
1640
+ }),
1641
+ ]),
1642
+ );
1643
+ anim.start();
1644
+ loop.start();
1645
+ return () => {
1646
+ anim.stop();
1647
+ loop.stop();
1648
+ };
1649
+ }, [drift, rise, still]);
1650
+ const SUN = 220;
1651
+ const GLOW = 420;
1652
+ const sunTop = height * 0.636;
1653
+ return (
1654
+ <View
1655
+ pointerEvents="none"
1656
+ style={{ position: 'absolute', left: 0, top: 0, width, height, overflow: 'hidden' }}
1657
+ {...hidden}
1658
+ >
1659
+ <Svg width={width} height={height} style={StyleSheet.absoluteFill}>
1660
+ <Defs>
1661
+ <LinearGradient id={sky} x1="0" y1="0" x2="0" y2="1">
1662
+ <Stop offset="0" stopColor="#FFF1E2" />
1663
+ <Stop offset="0.3" stopColor="#FFE2C4" />
1664
+ <Stop offset="0.52" stopColor="#FFC594" />
1665
+ <Stop offset="0.68" stopColor="#FF9E5E" />
1666
+ <Stop offset="0.76" stopColor="#FF8442" />
1667
+ <Stop offset="0.84" stopColor="#FFB47A" />
1668
+ <Stop offset="1" stopColor="#FFB47A" />
1669
+ </LinearGradient>
1670
+ </Defs>
1671
+ <Rect width={width} height={height} fill={`url(#${sky})`} />
1672
+ </Svg>
1673
+ <Animated.View
1674
+ style={{
1675
+ position: 'absolute',
1676
+ left: (width - GLOW) / 2,
1677
+ top: sunTop + SUN / 2 - GLOW / 2,
1678
+ width: GLOW,
1679
+ height: GLOW,
1680
+ opacity: rise.interpolate({ inputRange: [0, 1], outputRange: [0.6, 1] }),
1681
+ transform: [{ translateY: rise.interpolate({ inputRange: [0, 1], outputRange: [34, 0] }) }],
1682
+ }}
1683
+ >
1684
+ <Svg width={GLOW} height={GLOW}>
1685
+ <Defs>
1686
+ <RadialGradient id={sunGlow} cx="50%" cy="50%" r="50%">
1687
+ <Stop offset="0.3" stopColor="#FFD08A" stopOpacity={0.55} />
1688
+ <Stop offset="1" stopColor="#FFD08A" stopOpacity={0} />
1689
+ </RadialGradient>
1690
+ <RadialGradient id={sun} cx="50%" cy="42%" r="55%">
1691
+ <Stop offset="0" stopColor="#FFF4DC" />
1692
+ <Stop offset="0.38" stopColor="#FFD08A" />
1693
+ <Stop offset="0.7" stopColor="#FF9A4D" />
1694
+ <Stop offset="1" stopColor="#FF7A2A" />
1695
+ </RadialGradient>
1696
+ </Defs>
1697
+ <Circle cx={GLOW / 2} cy={GLOW / 2} r={GLOW / 2} fill={`url(#${sunGlow})`} />
1698
+ <Circle cx={GLOW / 2} cy={GLOW / 2} r={SUN / 2} fill={`url(#${sun})`} />
1699
+ </Svg>
1700
+ <Svg
1701
+ width={SUN * 0.64}
1702
+ height={SUN * 0.64}
1703
+ viewBox="0 0 16 16"
1704
+ style={{ position: 'absolute', left: GLOW / 2 - SUN * 0.32, top: GLOW / 2 - SUN * 0.32 }}
1705
+ >
1706
+ <Path
1707
+ d={MARK.HOUR}
1708
+ fill="none"
1709
+ stroke="rgba(150,52,0,0.3)"
1710
+ strokeWidth={0.7}
1711
+ strokeLinecap="round"
1712
+ />
1713
+ <Path
1714
+ d={MARK.MINUTE}
1715
+ fill="none"
1716
+ stroke="rgba(150,52,0,0.3)"
1717
+ strokeWidth={0.7}
1718
+ strokeLinecap="round"
1719
+ />
1720
+ </Svg>
1721
+ </Animated.View>
1722
+ <Animated.View
1723
+ style={{
1724
+ position: 'absolute',
1725
+ left: 0,
1726
+ top: height * 0.27,
1727
+ width,
1728
+ height: 120,
1729
+ transform: [
1730
+ { translateX: drift.interpolate({ inputRange: [0, 1], outputRange: [0, 26] }) },
1731
+ { translateY: drift.interpolate({ inputRange: [0, 1], outputRange: [0, -8] }) },
1732
+ ],
1733
+ }}
1734
+ >
1735
+ <Svg width={width} height={120} viewBox="0 0 390 120">
1736
+ <Path
1737
+ d="M118 52q5-5 10 0q5-5 10 0 M150 70q4-4 8 0q4-4 8 0 M96 84q3.5-3.5 7 0q3.5-3.5 7 0 M232 46q4.5-4.5 9 0q4.5-4.5 9 0 M262 66q3-3 6 0q3-3 6 0"
1738
+ fill="none"
1739
+ stroke="rgba(110,44,16,0.55)"
1740
+ strokeWidth={1.6}
1741
+ strokeLinecap="round"
1742
+ strokeLinejoin="round"
1743
+ />
1744
+ </Svg>
1745
+ </Animated.View>
1746
+ <Svg
1747
+ width={width}
1748
+ height={200}
1749
+ viewBox="0 0 390 200"
1750
+ preserveAspectRatio="none"
1751
+ style={{ position: 'absolute', left: 0, bottom: 0 }}
1752
+ >
1753
+ <Path
1754
+ d="M0 104 C 48 86 92 96 140 88 C 196 78 236 96 286 86 C 330 78 362 86 390 92 L 390 200 L 0 200 Z"
1755
+ fill="#F08A4E"
1756
+ />
1757
+ <Path
1758
+ d="M0 132 C 60 116 110 132 170 120 C 230 108 270 126 320 118 C 352 113 374 118 390 122 L 390 200 L 0 200 Z"
1759
+ fill="#D2663A"
1760
+ />
1761
+ <Path
1762
+ d="M0 158 C 70 142 130 160 200 150 C 262 141 318 156 390 146 L 390 200 L 0 200 Z"
1763
+ fill="#A94A26"
1764
+ />
1765
+ </Svg>
1766
+ <Svg width={width} height={190} style={{ position: 'absolute', left: 0, bottom: 0 }}>
1767
+ <Defs>
1768
+ <LinearGradient id={fadeId} x1="0" y1="0" x2="0" y2="1">
1769
+ <Stop offset="0" stopColor={ui.bg} stopOpacity={0} />
1770
+ <Stop offset="0.88" stopColor={ui.bg} stopOpacity={1} />
1771
+ <Stop offset="1" stopColor={ui.bg} stopOpacity={1} />
1772
+ </LinearGradient>
1773
+ </Defs>
1774
+ <Rect width={width} height={190} fill={`url(#${fadeId})`} />
1775
+ </Svg>
1776
+ </View>
1777
+ );
1778
+ }
1779
+
1780
+ /* ---------------------------------------------------------------------------------------------- the reminder */
1781
+
1782
+ /** The top of a lock screen on the reminder's day, with Clockbook's reminder on it. */
1783
+ export function LockPreview({ date, days }: { date: string; days: number }) {
1784
+ const wall = useSvgId('wall');
1785
+ const fadeId = useSvgId('lockFade');
1786
+ return (
1787
+ <View style={s.lockWrap} {...hidden}>
1788
+ <View style={s.lock}>
1789
+ <Svg
1790
+ width="100%"
1791
+ height="100%"
1792
+ style={StyleSheet.absoluteFill}
1793
+ viewBox="0 0 214 290"
1794
+ preserveAspectRatio="none"
1795
+ >
1796
+ <Defs>
1797
+ <RadialGradient id={wall} cx="50%" cy="100%" r="75%">
1798
+ <Stop offset="0" stopColor="#FF6A14" stopOpacity={0.4} />
1799
+ <Stop offset="1" stopColor="#FF6A14" stopOpacity={0} />
1800
+ </RadialGradient>
1801
+ </Defs>
1802
+ <Rect width="214" height="290" fill="#FFEDE0" />
1803
+ <Rect width="214" height="290" fill={`url(#${wall})`} />
1804
+ </Svg>
1805
+ <Text style={s.lockDate}>{date}</Text>
1806
+ <Text style={s.lockTime}>9:41</Text>
1807
+ <View style={s.note}>
1808
+ <View style={s.noteIcon}>
1809
+ <Mark size={20} />
1810
+ </View>
1811
+ <View style={s.noteText}>
1812
+ <View style={s.noteHead}>
1813
+ <Text style={s.noteApp}>Clockbook</Text>
1814
+ <Text style={s.noteWhen}>now</Text>
1815
+ </View>
1816
+ <Text style={s.noteBody}>
1817
+ Your free week ends in {days} days. Keep it, or cancel in Settings.
1818
+ </Text>
1819
+ </View>
1820
+ </View>
1821
+ <Svg width="100%" height={90} style={s.lockFade}>
1822
+ <Defs>
1823
+ <LinearGradient id={fadeId} x1="0" y1="0" x2="0" y2="1">
1824
+ <Stop offset="0" stopColor={ui.bg} stopOpacity={0} />
1825
+ <Stop offset="1" stopColor={ui.bg} stopOpacity={1} />
1826
+ </LinearGradient>
1827
+ </Defs>
1828
+ <Rect width="100%" height={90} fill={`url(#${fadeId})`} />
1829
+ </Svg>
1830
+ </View>
1831
+ </View>
1832
+ );
1833
+ }
1834
+
1835
+ /* ---------------------------------------------------------------------------------------------- styles */
1836
+
1837
+ export const text = StyleSheet.create({
1838
+ /** Lucy talking. */
1839
+ lucy: { fontFamily: fonts.sans, fontSize: 21, lineHeight: 29, letterSpacing: -0.3, color: ui.ink },
1840
+ /** What they answered. */
1841
+ you: { fontFamily: fonts.serifItalic, fontSize: 28, lineHeight: 34, color: ui.accentText },
1842
+ /** A name or a number inside Lucy's line. */
1843
+ accent: { color: ui.accentText },
1844
+ beat: { fontFamily: fonts.serif, fontSize: 40, lineHeight: 44, letterSpacing: -0.8, color: ui.ink },
1845
+ display: { fontFamily: fonts.serif, fontSize: 39, lineHeight: 42, letterSpacing: -0.8, color: ui.ink },
1846
+ lead: { fontFamily: fonts.sansMedium, fontSize: 23, lineHeight: 30, letterSpacing: -0.4, color: ui.ink },
1847
+ sub: { fontFamily: fonts.sans, fontSize: 17, lineHeight: 24, color: ui.muted },
1848
+ body: { fontFamily: fonts.sans, fontSize: 19, lineHeight: 26, color: ui.ink2 },
1849
+ note: { fontFamily: fonts.sans, fontSize: 15, lineHeight: 21, color: ui.muted },
1850
+ foot: { fontFamily: fonts.sans, fontSize: 12, lineHeight: 18, color: ui.muted },
1851
+ cue: { fontFamily: fonts.sansSemi, fontSize: 12, letterSpacing: 2.4, color: ui.accentText },
1852
+ });
1853
+
1854
+ const s = StyleSheet.create({
1855
+ words: { flexDirection: 'row', flexWrap: 'wrap' },
1856
+ wordsCenter: { justifyContent: 'center' },
1857
+ pressed: { transform: [{ scale: 0.985 }] },
1858
+ pressedSmall: { transform: [{ scale: 0.94 }] },
1859
+
1860
+ orbShadow: Platform.select<ViewStyle>({
1861
+ ios: { shadowColor: '#FF5A00', shadowOpacity: 0.32, shadowRadius: 16, shadowOffset: { width: 0, height: 10 } },
1862
+ default: {},
1863
+ }),
1864
+
1865
+ tick: {
1866
+ position: 'absolute',
1867
+ top: 8,
1868
+ left: '50%',
1869
+ marginLeft: -1,
1870
+ width: 2,
1871
+ height: 9,
1872
+ borderRadius: 1,
1873
+ backgroundColor: 'rgba(26,23,20,0.18)',
1874
+ },
1875
+ tickMajor: {
1876
+ position: 'absolute',
1877
+ top: 8,
1878
+ left: '50%',
1879
+ marginLeft: -1.5,
1880
+ width: 3,
1881
+ height: 17,
1882
+ borderRadius: 1.5,
1883
+ backgroundColor: 'rgba(26,23,20,0.42)',
1884
+ },
1885
+ tickLit: { backgroundColor: '#FF6A14', ...glowShadow(5, 0.9) },
1886
+ tickMajorLit: { backgroundColor: '#FF9A4D', ...glowShadow(5, 0.9) },
1887
+ hand: { position: 'absolute', backgroundColor: ui.ink },
1888
+ pin: {
1889
+ position: 'absolute',
1890
+ width: 13,
1891
+ height: 13,
1892
+ borderRadius: 6.5,
1893
+ backgroundColor: ui.ink,
1894
+ borderWidth: 4,
1895
+ borderColor: ui.bg,
1896
+ },
1897
+ pinLit: { backgroundColor: ui.accent },
1898
+
1899
+ // The power-on: the clock unlit on the dark, its flash as the ring closes, the hand's two colours, Lucy's rings
1900
+ // and the cream that floods out from her.
1901
+ tickDim: { backgroundColor: '#2B231D' },
1902
+ tickMajorDim: { backgroundColor: '#4A3C31' },
1903
+ poRim: { borderWidth: StyleSheet.hairlineWidth, borderColor: 'rgba(255,255,255,0.08)' },
1904
+ poRimPaper: { borderWidth: StyleSheet.hairlineWidth, borderColor: ui.hairline },
1905
+ poFlashRing: { borderWidth: 2, borderColor: 'rgba(255,170,110,0.9)' },
1906
+ poEmberHand: { borderRadius: 1.5, backgroundColor: EMBER, ...glowShadow(8, 0.9) },
1907
+ poInkHand: { borderRadius: 1.5, backgroundColor: ui.ink },
1908
+ poRing: {
1909
+ position: 'absolute',
1910
+ width: PO_MARK,
1911
+ height: PO_MARK,
1912
+ borderRadius: PO_MARK / 2,
1913
+ borderWidth: 2,
1914
+ borderColor: 'rgba(255,138,61,0.9)',
1915
+ },
1916
+ poCream: {
1917
+ position: 'absolute',
1918
+ width: PO_CREAM,
1919
+ height: PO_CREAM,
1920
+ borderRadius: PO_CREAM / 2,
1921
+ backgroundColor: ui.bg,
1922
+ },
1923
+
1924
+ btn: {
1925
+ height: 58,
1926
+ borderRadius: 29,
1927
+ flexDirection: 'row',
1928
+ alignItems: 'center',
1929
+ justifyContent: 'center',
1930
+ columnGap: 10,
1931
+ alignSelf: 'stretch',
1932
+ },
1933
+ btnInk: { backgroundColor: ui.ink },
1934
+ btnOrange: Platform.select<ViewStyle>({
1935
+ ios: { shadowColor: '#FF5A00', shadowOpacity: 0.55, shadowRadius: 18, shadowOffset: { width: 0, height: 12 } },
1936
+ default: { elevation: 3 },
1937
+ }),
1938
+ btnClip: { borderRadius: 29, overflow: 'hidden' },
1939
+ btnLabel: { fontFamily: fonts.sansSemi, fontSize: 17, letterSpacing: -0.2 },
1940
+ btnLabelOff: { opacity: 0.45 },
1941
+ soft: {
1942
+ height: 54,
1943
+ borderRadius: 27,
1944
+ flexDirection: 'row',
1945
+ alignItems: 'center',
1946
+ justifyContent: 'center',
1947
+ columnGap: 10,
1948
+ alignSelf: 'stretch',
1949
+ backgroundColor: ui.surface,
1950
+ borderWidth: StyleSheet.hairlineWidth,
1951
+ borderColor: 'rgba(26,23,20,0.12)',
1952
+ },
1953
+ softLabel: { fontFamily: fonts.sansMedium, fontSize: 16.5, color: ui.ink },
1954
+ link: {
1955
+ minHeight: 44,
1956
+ flexDirection: 'row',
1957
+ alignItems: 'center',
1958
+ justifyContent: 'center',
1959
+ columnGap: 6,
1960
+ alignSelf: 'center',
1961
+ paddingHorizontal: 8,
1962
+ },
1963
+ linkLabel: { fontFamily: fonts.sansMedium, fontSize: 15, color: ui.ink2 },
1964
+
1965
+ opt: {
1966
+ height: 58,
1967
+ borderRadius: 20,
1968
+ flexDirection: 'row',
1969
+ alignItems: 'center',
1970
+ columnGap: 14,
1971
+ paddingLeft: 11,
1972
+ paddingRight: 16,
1973
+ backgroundColor: ui.surface,
1974
+ borderWidth: StyleSheet.hairlineWidth,
1975
+ borderColor: 'rgba(26,23,20,0.1)',
1976
+ },
1977
+ optOn: { borderWidth: 1.5, borderColor: ui.accent, backgroundColor: '#FFF1E8' },
1978
+ optIcon: {
1979
+ width: 36,
1980
+ height: 36,
1981
+ borderRadius: 12,
1982
+ alignItems: 'center',
1983
+ justifyContent: 'center',
1984
+ backgroundColor: ui.accentSoft,
1985
+ },
1986
+ optLabel: { flex: 1, fontFamily: fonts.sansMedium, fontSize: 17, color: ui.ink },
1987
+ optLabelPlain: { marginLeft: 9 },
1988
+ optCheck: { width: 24, height: 24, borderRadius: 12, alignItems: 'center', justifyContent: 'center' },
1989
+ optCheckOn: { backgroundColor: ui.accent },
1990
+ num: {
1991
+ width: 52,
1992
+ height: 52,
1993
+ borderRadius: 26,
1994
+ alignItems: 'center',
1995
+ justifyContent: 'center',
1996
+ backgroundColor: ui.surface,
1997
+ borderWidth: StyleSheet.hairlineWidth,
1998
+ borderColor: 'rgba(26,23,20,0.1)',
1999
+ },
2000
+ numOn: { backgroundColor: ui.accent, borderColor: ui.accent },
2001
+ numLabel: { fontFamily: fonts.serif, fontSize: 26, color: ui.ink },
2002
+ numLabelOn: { color: ui.ink },
2003
+ track: {
2004
+ height: 6,
2005
+ borderRadius: 3,
2006
+ backgroundColor: ui.fill,
2007
+ overflow: 'hidden',
2008
+ marginHorizontal: 8,
2009
+ marginTop: 6,
2010
+ },
2011
+ trackFill: { height: 6, width: '100%', borderRadius: 3, overflow: 'hidden' },
2012
+
2013
+ rollWindow: { height: ROW * 3, alignSelf: 'stretch', overflow: 'hidden', marginTop: 8 },
2014
+ rollRow: {
2015
+ height: ROW,
2016
+ lineHeight: ROW,
2017
+ fontFamily: fonts.serif,
2018
+ fontSize: 92,
2019
+ letterSpacing: -2.5,
2020
+ textAlign: 'center',
2021
+ color: ui.accent,
2022
+ includeFontPadding: false,
2023
+ },
2024
+ odoRow: { flexDirection: 'row', alignItems: 'flex-end', justifyContent: 'center', columnGap: 12 },
2025
+ odoNum: { flexDirection: 'row', height: DIGIT, overflow: 'hidden' },
2026
+ odoCol: { height: DIGIT, overflow: 'hidden' },
2027
+ odoDigit: {
2028
+ height: DIGIT,
2029
+ lineHeight: DIGIT,
2030
+ fontFamily: fonts.serif,
2031
+ fontSize: 124,
2032
+ letterSpacing: -2,
2033
+ textAlign: 'center',
2034
+ color: ui.accent,
2035
+ includeFontPadding: false,
2036
+ },
2037
+ odoUnit: { fontFamily: fonts.serifItalic, fontSize: 44, lineHeight: 50, color: ui.accentText, marginBottom: 18 },
2038
+
2039
+ frameWrap: { alignSelf: 'center', width: '100%', maxWidth: 334 },
2040
+ frameGlow: {
2041
+ borderRadius: 42,
2042
+ borderWidth: 1.5,
2043
+ borderColor: 'rgba(255,138,61,0.8)',
2044
+ backgroundColor: 'rgba(255,90,0,0.035)',
2045
+ ...glowShadow(20, 0.45),
2046
+ },
2047
+ frame: { padding: 15 },
2048
+ alert: {
2049
+ borderRadius: 30,
2050
+ backgroundColor: 'rgba(242,237,232,0.98)',
2051
+ paddingTop: 20,
2052
+ paddingHorizontal: 16,
2053
+ paddingBottom: 14,
2054
+ ...Platform.select<ViewStyle>({
2055
+ ios: {
2056
+ shadowColor: '#2B1A0C',
2057
+ shadowOpacity: 0.12,
2058
+ shadowRadius: 18,
2059
+ shadowOffset: { width: 0, height: 10 },
2060
+ },
2061
+ default: { elevation: 2 },
2062
+ }),
2063
+ },
2064
+ alertTitle: {
2065
+ fontFamily: fonts.sansSemi,
2066
+ fontSize: 17,
2067
+ lineHeight: 22,
2068
+ color: ui.ink,
2069
+ paddingHorizontal: 4,
2070
+ marginBottom: 8,
2071
+ },
2072
+ alertBody: {
2073
+ fontFamily: fonts.sans,
2074
+ fontSize: 14.5,
2075
+ lineHeight: 20,
2076
+ color: ui.ink2,
2077
+ paddingHorizontal: 4,
2078
+ marginBottom: 16,
2079
+ },
2080
+ alertButtons: { flexDirection: 'row', columnGap: 8 },
2081
+ alertBtn: {
2082
+ flex: 1,
2083
+ height: 46,
2084
+ borderRadius: 23,
2085
+ alignItems: 'center',
2086
+ justifyContent: 'center',
2087
+ backgroundColor: 'rgba(26,23,20,0.07)',
2088
+ },
2089
+ alertBtnYes: { backgroundColor: 'rgba(26,23,20,0.13)' },
2090
+ alertBtnLabel: { fontFamily: fonts.sansMedium, fontSize: 16, color: ui.ink },
2091
+ alertBtnLabelYes: { fontFamily: fonts.sansSemi },
2092
+ arrow: { width: 120, height: 104, marginTop: -2, alignSelf: 'center', left: 50 },
2093
+
2094
+ burst: { position: 'absolute', left: '50%', width: 0, height: 0 },
2095
+ ring: {
2096
+ position: 'absolute',
2097
+ left: -85,
2098
+ top: -85,
2099
+ width: 170,
2100
+ height: 170,
2101
+ borderRadius: 85,
2102
+ borderWidth: 2,
2103
+ borderColor: 'rgba(255,138,61,0.75)',
2104
+ ...glowShadow(16, 0.5),
2105
+ },
2106
+ part: {
2107
+ position: 'absolute',
2108
+ left: -13,
2109
+ top: -13,
2110
+ width: 26,
2111
+ height: 26,
2112
+ alignItems: 'center',
2113
+ justifyContent: 'center',
2114
+ },
2115
+ dot: { width: 9, height: 9, borderRadius: 4.5 },
2116
+ sliver: { width: 5, height: 15, borderRadius: 3 },
2117
+
2118
+ lockWrap: { width: 214, height: 290, alignSelf: 'center' },
2119
+ lock: {
2120
+ width: 214,
2121
+ height: 290,
2122
+ borderTopLeftRadius: 44,
2123
+ borderTopRightRadius: 44,
2124
+ overflow: 'hidden',
2125
+ borderWidth: 1.5,
2126
+ borderBottomWidth: 0,
2127
+ borderColor: 'rgba(255,138,61,0.75)',
2128
+ paddingTop: 26,
2129
+ paddingHorizontal: 12,
2130
+ alignItems: 'center',
2131
+ },
2132
+ lockDate: { fontFamily: fonts.sansMedium, fontSize: 13, color: ui.ink, opacity: 0.8 },
2133
+ lockTime: { fontFamily: fonts.serif, fontSize: 76, lineHeight: 82, letterSpacing: -1.5, color: ui.ink },
2134
+ note: {
2135
+ position: 'absolute',
2136
+ left: 10,
2137
+ right: 10,
2138
+ top: 150,
2139
+ flexDirection: 'row',
2140
+ alignItems: 'flex-start',
2141
+ columnGap: 9,
2142
+ padding: 11,
2143
+ borderRadius: 18,
2144
+ backgroundColor: 'rgba(255,255,255,0.86)',
2145
+ },
2146
+ noteIcon: {
2147
+ width: 28,
2148
+ height: 28,
2149
+ borderRadius: 8,
2150
+ backgroundColor: '#FFFFFF',
2151
+ alignItems: 'center',
2152
+ justifyContent: 'center',
2153
+ },
2154
+ noteText: { flex: 1, rowGap: 2 },
2155
+ noteHead: { flexDirection: 'row', justifyContent: 'space-between' },
2156
+ noteApp: { fontFamily: fonts.sansSemi, fontSize: 11.5, color: ui.ink },
2157
+ noteWhen: { fontFamily: fonts.sans, fontSize: 11.5, color: ui.muted },
2158
+ noteBody: { fontFamily: fonts.sans, fontSize: 11.5, lineHeight: 15, color: ui.ink2 },
2159
+ lockFade: { position: 'absolute', left: 0, bottom: 0 },
2160
+ });