@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.
- package/.claude-flow/data/pending-insights.jsonl +43 -0
- package/.claude-flow/sessions/session-1794323376548.json +14 -0
- package/CHANGELOG.md +41 -0
- package/jest.config.cjs +22 -0
- package/lib/assets/home/loop-day.jpg +0 -0
- package/lib/assets/home/loop-day.mp4 +0 -0
- package/lib/assets/home/loop-time-back.jpg +0 -0
- package/lib/assets/home/loop-time-back.mp4 +0 -0
- package/lib/assets/home/loop-where.jpg +0 -0
- package/lib/assets/home/loop-where.mp4 +0 -0
- package/lib/assets/home/reel-gym.jpg +0 -0
- package/lib/assets/home/reel-gym.mp4 +0 -0
- package/lib/assets/home/reel-internet.jpg +0 -0
- package/lib/assets/home/reel-internet.mp4 +0 -0
- package/lib/assets/icon.png +0 -0
- package/lib/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
- package/lib/assets/lottie/lucy-mark-calendar.json +1827 -0
- package/lib/assets/lottie/lucy-mark-call.json +1470 -0
- package/lib/assets/lottie/lucy-mark-connect.json +2552 -0
- package/lib/assets/lottie/lucy-mark-details.json +1735 -0
- package/lib/assets/lottie/lucy-mark-email.json +1363 -0
- package/lib/assets/lottie/lucy-mark-message.json +1154 -0
- package/lib/assets/lottie/lucy-mark-search.json +1067 -0
- package/lib/assets/lottie/lucy-mark-think.json +1253 -0
- package/lib/assets/lottie/lucy-mark-write.json +1532 -0
- package/lib/assets/lottie/time-back.json +16458 -0
- package/lib/assets/lottie/where-lucy-works-chat.json +6170 -0
- package/lib/assets/lottie/where-lucy-works-cloud.json +10066 -0
- package/lib/assets/lottie/where-lucy-works-mine-none.json +2478 -0
- package/lib/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
- package/lib/assets/lottie/where-lucy-works-mine-online.json +7881 -0
- package/lib/assets/sounds/hours-back.m4a +0 -0
- package/lib/assets/sounds/meet-lucy.m4a +0 -0
- package/lib/assets/sounds/power-on.m4a +0 -0
- package/lib/assets/sounds/wind-back.m4a +0 -0
- package/lib/assets/sounds/youre-in.m4a +0 -0
- package/lib/chat/agent.js +358 -0
- package/lib/chat/agent.js.map +1 -0
- package/lib/chat/appFront.js +32 -0
- package/lib/chat/appFront.js.map +1 -0
- package/lib/chat/auth.js +370 -0
- package/lib/chat/auth.js.map +1 -0
- package/lib/chat/chores.js +360 -0
- package/lib/chat/chores.js.map +1 -0
- package/lib/chat/connectors.js +45 -0
- package/lib/chat/connectors.js.map +1 -0
- package/lib/chat/jobs.js +223 -0
- package/lib/chat/jobs.js.map +1 -0
- package/lib/chat/lucyMotion.js +6 -0
- package/lib/chat/lucyMotion.js.map +1 -0
- package/lib/chat/protocol.js +111 -0
- package/lib/chat/protocol.js.map +1 -0
- package/lib/chat/results.js +133 -0
- package/lib/chat/results.js.map +1 -0
- package/lib/chat/store.js +81 -0
- package/lib/chat/store.js.map +1 -0
- package/lib/chat/useDictation.js +168 -0
- package/lib/chat/useDictation.js.map +1 -0
- package/lib/chat/useLucyChat.js +451 -0
- package/lib/chat/useLucyChat.js.map +1 -0
- package/lib/chat/useMyComputer.js +32 -0
- package/lib/chat/useMyComputer.js.map +1 -0
- package/lib/chat/whereLucyWorks.js +52 -0
- package/lib/chat/whereLucyWorks.js.map +1 -0
- package/lib/chat/workspace.js +124 -0
- package/lib/chat/workspace.js.map +1 -0
- package/lib/components/AreaShot.js +289 -0
- package/lib/components/AreaShot.js.map +1 -0
- package/lib/components/Backdrops.js +262 -0
- package/lib/components/Backdrops.js.map +1 -0
- package/lib/components/BottomSheet.js +61 -0
- package/lib/components/BottomSheet.js.map +1 -0
- package/lib/components/ChatSheets.js +429 -0
- package/lib/components/ChatSheets.js.map +1 -0
- package/lib/components/ConnectorLogo.js +91 -0
- package/lib/components/ConnectorLogo.js.map +1 -0
- package/lib/components/CustomDrawer.js +534 -0
- package/lib/components/CustomDrawer.js.map +1 -0
- package/lib/components/IdeasPane.js +394 -0
- package/lib/components/IdeasPane.js.map +1 -0
- package/lib/components/ImessageSheet.js +261 -0
- package/lib/components/ImessageSheet.js.map +1 -0
- package/lib/components/KeyboardAvoider.js +29 -0
- package/lib/components/KeyboardAvoider.js.map +1 -0
- package/lib/components/Logo.js +81 -0
- package/lib/components/Logo.js.map +1 -0
- package/lib/components/LucyWorking.js +67 -0
- package/lib/components/LucyWorking.js.map +1 -0
- package/lib/components/Markdown.js +260 -0
- package/lib/components/Markdown.js.map +1 -0
- package/lib/components/Media.js +93 -0
- package/lib/components/Media.js.map +1 -0
- package/lib/components/MessagesAppIcon.js +23 -0
- package/lib/components/MessagesAppIcon.js.map +1 -0
- package/lib/components/MicButton.js +71 -0
- package/lib/components/MicButton.js.map +1 -0
- package/lib/components/ResultCards.js +974 -0
- package/lib/components/ResultCards.js.map +1 -0
- package/lib/components/SignInPrompt.js +148 -0
- package/lib/components/SignInPrompt.js.map +1 -0
- package/lib/components/SignedOut.js +38 -0
- package/lib/components/SignedOut.js.map +1 -0
- package/lib/components/TalkToLucyHero.js +487 -0
- package/lib/components/TalkToLucyHero.js.map +1 -0
- package/lib/components/TalkToLucySheet.js +182 -0
- package/lib/components/TalkToLucySheet.js.map +1 -0
- package/lib/components/WhereLucyWorks.js +277 -0
- package/lib/components/WhereLucyWorks.js.map +1 -0
- package/lib/components/WorkspaceSection.js +271 -0
- package/lib/components/WorkspaceSection.js.map +1 -0
- package/lib/components/YantraMark.js +13 -0
- package/lib/components/YantraMark.js.map +1 -0
- package/lib/components/drawerHeader.js +38 -0
- package/lib/components/drawerHeader.js.map +1 -0
- package/lib/components/lottieInstalled.js +6 -0
- package/lib/components/lottieInstalled.js.map +1 -0
- package/lib/components/ui.js +550 -0
- package/lib/components/ui.js.map +1 -0
- package/lib/components/useSignOut.js +7 -0
- package/lib/components/useSignOut.js.map +1 -0
- package/lib/components/viewport.js +121 -0
- package/lib/components/viewport.js.map +1 -0
- package/lib/components/voiceDial.js +10 -0
- package/lib/components/voiceDial.js.map +1 -0
- package/lib/compute.js +157 -0
- package/lib/compute.js.map +1 -0
- package/lib/config/env-config.js +27 -0
- package/lib/config/env-config.js.map +1 -0
- package/lib/config/routes.js +15 -0
- package/lib/config/routes.js.map +1 -0
- package/lib/content.js +25 -0
- package/lib/content.js.map +1 -0
- package/lib/hooks/keyboardCover.js +39 -0
- package/lib/hooks/keyboardCover.js.map +1 -0
- package/lib/hooks/useKeyboard.js +121 -0
- package/lib/hooks/useKeyboard.js.map +1 -0
- package/lib/hooks/useReducedMotion.js +13 -0
- package/lib/hooks/useReducedMotion.js.map +1 -0
- package/lib/imessage/openMessages.js +25 -0
- package/lib/imessage/openMessages.js.map +1 -0
- package/lib/imessage/platform.js +12 -0
- package/lib/imessage/platform.js.map +1 -0
- package/lib/imessage/textLink.js +262 -0
- package/lib/imessage/textLink.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/live/card.js +28 -0
- package/lib/live/card.js.map +1 -0
- package/lib/live/liveActivity.js +144 -0
- package/lib/live/liveActivity.js.map +1 -0
- package/lib/module.js +3 -0
- package/lib/module.js.map +1 -0
- package/lib/offer/BlackFridayOffer.js +378 -0
- package/lib/offer/BlackFridayOffer.js.map +1 -0
- package/lib/offer/blackFriday.js +78 -0
- package/lib/offer/blackFriday.js.map +1 -0
- package/lib/offer/parts.js +624 -0
- package/lib/offer/parts.js.map +1 -0
- package/lib/offer/state.js +63 -0
- package/lib/offer/state.js.map +1 -0
- package/lib/push/push.js +142 -0
- package/lib/push/push.js.map +1 -0
- package/lib/push/usePushNotifications.js +39 -0
- package/lib/push/usePushNotifications.js.map +1 -0
- package/lib/routes.json +175 -0
- package/lib/screens/Account/index.js +209 -0
- package/lib/screens/Account/index.js.map +1 -0
- package/lib/screens/Chat/index.js +710 -0
- package/lib/screens/Chat/index.js.map +1 -0
- package/lib/screens/Chores/index.js +18 -0
- package/lib/screens/Chores/index.js.map +1 -0
- package/lib/screens/Connectors/index.js +17 -0
- package/lib/screens/Connectors/index.js.map +1 -0
- package/lib/screens/History/index.js +380 -0
- package/lib/screens/History/index.js.map +1 -0
- package/lib/screens/Home/index.js +2715 -0
- package/lib/screens/Home/index.js.map +1 -0
- package/lib/screens/Home/media.js +25 -0
- package/lib/screens/Home/media.js.map +1 -0
- package/lib/screens/Welcome/index.js +1066 -0
- package/lib/screens/Welcome/index.js.map +1 -0
- package/lib/talk/talkToLucy.js +139 -0
- package/lib/talk/talkToLucy.js.map +1 -0
- package/lib/theme/colors.js +29 -0
- package/lib/theme/colors.js.map +1 -0
- package/lib/theme/fonts.js +17 -0
- package/lib/theme/fonts.js.map +1 -0
- package/lib/theme/muse.js +134 -0
- package/lib/theme/muse.js.map +1 -0
- package/lib/utils/links.js +54 -0
- package/lib/utils/links.js.map +1 -0
- package/lib/utils/yantraLinks.js +68 -0
- package/lib/utils/yantraLinks.js.map +1 -0
- package/lib/welcome/flow.js +375 -0
- package/lib/welcome/flow.js.map +1 -0
- package/lib/welcome/haptics.js +125 -0
- package/lib/welcome/haptics.js.map +1 -0
- package/lib/welcome/parts.js +1996 -0
- package/lib/welcome/parts.js.map +1 -0
- package/lib/welcome/powerOn.js +29 -0
- package/lib/welcome/powerOn.js.map +1 -0
- package/lib/welcome/seen.js +41 -0
- package/lib/welcome/seen.js.map +1 -0
- package/lib/welcome/sound.js +110 -0
- package/lib/welcome/sound.js.map +1 -0
- package/package.json +66 -5
- package/rollup.config.mjs +42 -0
- package/src/.claude-flow/data/pending-insights.jsonl +19 -0
- package/src/.claude-flow/sessions/session-1795013028422.json +14 -0
- package/src/__tests__/auth.test.ts +94 -0
- package/src/__tests__/blackFriday.test.ts +75 -0
- package/src/__tests__/cardTokens.test.ts +77 -0
- package/src/__tests__/chores.test.ts +188 -0
- package/src/__tests__/choresList.test.ts +100 -0
- package/src/__tests__/connectLink.test.ts +21 -0
- package/src/__tests__/content.test.ts +54 -0
- package/src/__tests__/dictation.test.ts +186 -0
- package/src/__tests__/envConfig.test.ts +14 -0
- package/src/__tests__/haptics.test.ts +202 -0
- package/src/__tests__/jobs.test.ts +130 -0
- package/src/__tests__/keyboardCover.test.ts +84 -0
- package/src/__tests__/liveCard.test.ts +39 -0
- package/src/__tests__/lockedPhone.test.ts +355 -0
- package/src/__tests__/lucyMotion.test.ts +34 -0
- package/src/__tests__/platform.test.ts +32 -0
- package/src/__tests__/powerOn.test.ts +62 -0
- package/src/__tests__/protocol.test.ts +125 -0
- package/src/__tests__/push.test.ts +111 -0
- package/src/__tests__/results.test.ts +256 -0
- package/src/__tests__/sound.test.ts +248 -0
- package/src/__tests__/talkToLucy.test.ts +205 -0
- package/src/__tests__/textLink.test.ts +91 -0
- package/src/__tests__/voiceDial.test.ts +53 -0
- package/src/__tests__/welcomeFlow.test.ts +157 -0
- package/src/__tests__/whereLucyWorks.test.ts +81 -0
- package/src/__tests__/yantraLinks.test.ts +96 -0
- package/src/assets/home/loop-day.jpg +0 -0
- package/src/assets/home/loop-day.mp4 +0 -0
- package/src/assets/home/loop-time-back.jpg +0 -0
- package/src/assets/home/loop-time-back.mp4 +0 -0
- package/src/assets/home/loop-where.jpg +0 -0
- package/src/assets/home/loop-where.mp4 +0 -0
- package/src/assets/home/reel-gym.jpg +0 -0
- package/src/assets/home/reel-gym.mp4 +0 -0
- package/src/assets/home/reel-internet.jpg +0 -0
- package/src/assets/home/reel-internet.mp4 +0 -0
- package/src/assets/icon.png +0 -0
- package/src/assets/lottie/.claude-flow/data/pending-insights.jsonl +1 -0
- package/src/assets/lottie/lucy-mark-calendar.json +1827 -0
- package/src/assets/lottie/lucy-mark-call.json +1470 -0
- package/src/assets/lottie/lucy-mark-connect.json +2552 -0
- package/src/assets/lottie/lucy-mark-details.json +1735 -0
- package/src/assets/lottie/lucy-mark-email.json +1363 -0
- package/src/assets/lottie/lucy-mark-message.json +1154 -0
- package/src/assets/lottie/lucy-mark-search.json +1067 -0
- package/src/assets/lottie/lucy-mark-think.json +1253 -0
- package/src/assets/lottie/lucy-mark-write.json +1532 -0
- package/src/assets/lottie/time-back.json +16458 -0
- package/src/assets/lottie/where-lucy-works-chat.json +6170 -0
- package/src/assets/lottie/where-lucy-works-cloud.json +10066 -0
- package/src/assets/lottie/where-lucy-works-mine-none.json +2478 -0
- package/src/assets/lottie/where-lucy-works-mine-offline.json +2373 -0
- package/src/assets/lottie/where-lucy-works-mine-online.json +7881 -0
- package/src/assets/sounds/hours-back.m4a +0 -0
- package/src/assets/sounds/meet-lucy.m4a +0 -0
- package/src/assets/sounds/power-on.m4a +0 -0
- package/src/assets/sounds/wind-back.m4a +0 -0
- package/src/assets/sounds/youre-in.m4a +0 -0
- package/src/chat/.claude-flow/data/pending-insights.jsonl +1 -0
- package/src/chat/agent.ts +376 -0
- package/src/chat/appFront.ts +39 -0
- package/src/chat/auth.ts +433 -0
- package/src/chat/chores.ts +394 -0
- package/src/chat/connectors.ts +75 -0
- package/src/chat/jobs.ts +228 -0
- package/src/chat/lucyMotion.ts +33 -0
- package/src/chat/protocol.ts +192 -0
- package/src/chat/results.ts +224 -0
- package/src/chat/store.ts +87 -0
- package/src/chat/useDictation.ts +201 -0
- package/src/chat/useLucyChat.ts +458 -0
- package/src/chat/useMyComputer.ts +41 -0
- package/src/chat/whereLucyWorks.ts +97 -0
- package/src/chat/workspace.ts +127 -0
- package/src/components/.claude-flow/data/pending-insights.jsonl +3 -0
- package/src/components/AreaShot.tsx +239 -0
- package/src/components/Backdrops.tsx +323 -0
- package/src/components/BottomSheet.tsx +96 -0
- package/src/components/ChatSheets.tsx +565 -0
- package/src/components/ConnectorLogo.tsx +116 -0
- package/src/components/CustomDrawer.tsx +526 -0
- package/src/components/IdeasPane.tsx +318 -0
- package/src/components/ImessageSheet.tsx +280 -0
- package/src/components/KeyboardAvoider.tsx +45 -0
- package/src/components/Logo.tsx +97 -0
- package/src/components/LucyWorking.tsx +122 -0
- package/src/components/Markdown.tsx +219 -0
- package/src/components/Media.tsx +173 -0
- package/src/components/MessagesAppIcon.tsx +51 -0
- package/src/components/MicButton.tsx +92 -0
- package/src/components/ResultCards.tsx +1067 -0
- package/src/components/SignInPrompt.tsx +182 -0
- package/src/components/SignedOut.tsx +47 -0
- package/src/components/TalkToLucyHero.tsx +540 -0
- package/src/components/TalkToLucySheet.tsx +208 -0
- package/src/components/VoiceOrb.tsx +364 -0
- package/src/components/WhereLucyWorks.tsx +261 -0
- package/src/components/WorkspaceSection.tsx +307 -0
- package/src/components/YantraMark.tsx +30 -0
- package/src/components/drawerHeader.tsx +46 -0
- package/src/components/kit.tsx +309 -0
- package/src/components/lottieInstalled.ts +7 -0
- package/src/components/ui.tsx +700 -0
- package/src/components/useSignOut.ts +21 -0
- package/src/components/viewport.tsx +166 -0
- package/src/components/voiceDial.ts +45 -0
- package/src/compute.ts +168 -0
- package/src/config/env-config.ts +50 -0
- package/src/config/routes.ts +28 -0
- package/src/content.ts +217 -0
- package/src/hooks/keyboardCover.ts +70 -0
- package/src/hooks/useKeyboard.ts +135 -0
- package/src/hooks/useReducedMotion.ts +19 -0
- package/src/imessage/openMessages.ts +53 -0
- package/src/imessage/platform.ts +32 -0
- package/src/imessage/textLink.ts +307 -0
- package/src/index.ts +24 -0
- package/src/live/card.ts +62 -0
- package/src/live/liveActivity.ts +192 -0
- package/src/module.ts +8 -0
- package/src/offer/BlackFridayOffer.tsx +394 -0
- package/src/offer/blackFriday.ts +109 -0
- package/src/offer/parts.tsx +650 -0
- package/src/offer/state.ts +78 -0
- package/src/push/push.ts +171 -0
- package/src/push/usePushNotifications.ts +47 -0
- package/src/screens/Account/index.tsx +310 -0
- package/src/screens/Chat/.claude-flow/data/pending-insights.jsonl +4 -0
- package/src/screens/Chat/index.tsx +891 -0
- package/src/screens/Chores/index.tsx +35 -0
- package/src/screens/Connectors/index.tsx +35 -0
- package/src/screens/History/index.tsx +346 -0
- package/src/screens/Home/index.tsx +2776 -0
- package/src/screens/Home/media.ts +31 -0
- package/src/screens/Welcome/index.tsx +1182 -0
- package/src/talk/talkToLucy.ts +187 -0
- package/src/theme/colors.ts +38 -0
- package/src/theme/fonts.ts +30 -0
- package/src/theme/muse.ts +86 -0
- package/src/utils/links.ts +84 -0
- package/src/utils/yantraLinks.ts +94 -0
- package/src/welcome/flow.ts +418 -0
- package/src/welcome/haptics.ts +179 -0
- package/src/welcome/parts.tsx +2160 -0
- package/src/welcome/powerOn.ts +84 -0
- package/src/welcome/seen.ts +68 -0
- package/src/welcome/sound.ts +173 -0
- package/tools/lottie/chat.motion +0 -0
- package/tools/lottie/cloud.motion +0 -0
- package/tools/lottie/generate.mjs +1209 -0
- package/tools/lottie/inter-glyphs.json +4416 -0
- package/tools/lottie/lucy-mark-calendar.motion +0 -0
- package/tools/lottie/lucy-mark-call.motion +0 -0
- package/tools/lottie/lucy-mark-connect.motion +0 -0
- package/tools/lottie/lucy-mark-details.motion +0 -0
- package/tools/lottie/lucy-mark-email.motion +0 -0
- package/tools/lottie/lucy-mark-message.motion +0 -0
- package/tools/lottie/lucy-mark-search.motion +0 -0
- package/tools/lottie/lucy-mark-think.motion +0 -0
- package/tools/lottie/lucy-mark-write.motion +0 -0
- package/tools/lottie/mark.json +1 -0
- package/tools/lottie/mine-none.motion +0 -0
- package/tools/lottie/mine-offline.motion +0 -0
- package/tools/lottie/mine-online.motion +0 -0
- package/tools/lottie/time-back.mjs +604 -0
- package/tools/sounds/render.mjs +730 -0
- package/tsconfig.json +17 -0
- package/README.md +0 -3
|
@@ -0,0 +1,1209 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generates the app's Lottie animations with the Motion engine (yantra-motion, CDEBase/third-party-extensions
|
|
4
|
+
* packages-binaries/yantra-motion), so each one is a real motion-graphics project.
|
|
5
|
+
*
|
|
6
|
+
* YANTRA_MOTION_BIN=/path/to/yantra-motion node tools/lottie/generate.mjs [scene]
|
|
7
|
+
*
|
|
8
|
+
* For each scene it writes tools/lottie/<scene>.motion, which opens in the Motion editor, and
|
|
9
|
+
* src/assets/lottie/<asset>.json, which the app plays. Every file has two markers: `start`, which plays once,
|
|
10
|
+
* and `loop`, a seamless idle. Set WLW_PREVIEW=<dir> to also render an mp4 of each.
|
|
11
|
+
*
|
|
12
|
+
* The app plays a where-Lucy-works scene once and holds the frame `loop` starts on when the card must not move,
|
|
13
|
+
* so START_FRAMES and TOTAL must match SCENE_SETTLED_FRAME and SCENE_FRAMES in src/chat/whereLucyWorks.ts. The
|
|
14
|
+
* logo's frame numbers (MARK_CONTENT, MARK_START, MARK_END) must match components/LucyWorking.tsx.
|
|
15
|
+
*/
|
|
16
|
+
import { execFileSync } from 'node:child_process';
|
|
17
|
+
import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
18
|
+
import { dirname, join } from 'node:path';
|
|
19
|
+
import { tmpdir } from 'node:os';
|
|
20
|
+
import { fileURLToPath } from 'node:url';
|
|
21
|
+
|
|
22
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
const ASSETS = join(HERE, '../../src/assets/lottie');
|
|
24
|
+
const BIN = process.env.YANTRA_MOTION_BIN || 'yantra-motion';
|
|
25
|
+
|
|
26
|
+
const W = 338;
|
|
27
|
+
const H = 132;
|
|
28
|
+
const FPS = 60;
|
|
29
|
+
export const START_FRAMES = 216;
|
|
30
|
+
export const LOOP_FRAMES = 72;
|
|
31
|
+
const TOTAL = START_FRAMES + LOOP_FRAMES;
|
|
32
|
+
|
|
33
|
+
const C = {
|
|
34
|
+
orange: '#FF5A00',
|
|
35
|
+
orangeText: '#B84100',
|
|
36
|
+
orangeSoft: '#FFE9DB',
|
|
37
|
+
ink: '#1C1A18',
|
|
38
|
+
muted: '#6F675F',
|
|
39
|
+
soft: '#FFF1E6',
|
|
40
|
+
white: '#FFFFFF',
|
|
41
|
+
line: '#F1E4D8',
|
|
42
|
+
quiet: '#D9CFC6',
|
|
43
|
+
track: '#F6EFE9',
|
|
44
|
+
online: '#1F9D61',
|
|
45
|
+
peach: '#FFB58A',
|
|
46
|
+
dotA: '#F2B8A0',
|
|
47
|
+
dotB: '#F4D9A8',
|
|
48
|
+
dotC: '#BFE3C8',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const PHONE = { x: 37, y: H / 2, w: 42, h: 74 };
|
|
52
|
+
const DEVICE = { x: W - 16 - 86, y: H / 2 };
|
|
53
|
+
const WINDOW = { w: 172, h: 106 };
|
|
54
|
+
const SCREEN = { w: 146, h: 88 };
|
|
55
|
+
const ARC = {
|
|
56
|
+
from: [66, H / 2],
|
|
57
|
+
via: [104, H / 2 - 26],
|
|
58
|
+
to: [142, H / 2],
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Property paths in the Motion engine. A layer's newest shape group is always `contents/group`.
|
|
62
|
+
const RECT = { roundness: 'contents/group/contents/rect/roundness', size: 'contents/group/contents/rect/size' };
|
|
63
|
+
const FILL_COLOR = 'contents/group/contents/fill/color';
|
|
64
|
+
const DASHES = {
|
|
65
|
+
dash: 'contents/group/contents/stroke/dashes/dash',
|
|
66
|
+
gap: 'contents/group/contents/stroke/dashes/gap',
|
|
67
|
+
offset: 'contents/group/contents/stroke/dashes/offset',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const lerp = (a, b, u) => a + (b - a) * u;
|
|
71
|
+
const clamp = (v) => Math.min(1, Math.max(0, v));
|
|
72
|
+
const smooth = (v) => {
|
|
73
|
+
const x = clamp(v);
|
|
74
|
+
return x * x * x * (x * (x * 6 - 15) + 10);
|
|
75
|
+
};
|
|
76
|
+
const bezier = (a, c, b, u) => [
|
|
77
|
+
lerp(lerp(a[0], c[0], u), lerp(c[0], b[0], u), u),
|
|
78
|
+
lerp(lerp(a[1], c[1], u), lerp(c[1], b[1], u), u),
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
/** A spring let go `seconds` ago: past 1 and back to rest. */
|
|
82
|
+
function spring(seconds, response = 0.42, damping = 0.62) {
|
|
83
|
+
if (seconds <= 0) return 0;
|
|
84
|
+
const natural = (2 * Math.PI) / response;
|
|
85
|
+
const damped = natural * Math.sqrt(1 - damping * damping);
|
|
86
|
+
const decay = Math.exp(-damping * natural * seconds);
|
|
87
|
+
return 1 - decay * (Math.cos(damped * seconds) + ((damping * natural) / damped) * Math.sin(damped * seconds));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const round = (v) => Math.round(v * 1000) / 1000;
|
|
91
|
+
const seconds = (frame) => Math.round((frame / FPS) * 1e6) / 1e6;
|
|
92
|
+
|
|
93
|
+
const OPACITY = 'transform/opacity';
|
|
94
|
+
const TOLERANCE = { 'transform/position': 0.04, 'transform/scale': 0.1, 'transform/rotation': 0.15, [OPACITY]: 0.4 };
|
|
95
|
+
|
|
96
|
+
/** Drops keys that a straight line between their neighbours already reproduces, so sampled springs stay small. */
|
|
97
|
+
function simplify(keys, tolerance) {
|
|
98
|
+
if (keys.length < 3 || typeof keys[0][1] === 'string') return keys;
|
|
99
|
+
const dims = (key) => (Array.isArray(key[1]) ? key[1] : [key[1]]);
|
|
100
|
+
const keep = new Set([0, keys.length - 1]);
|
|
101
|
+
const walk = (a, b) => {
|
|
102
|
+
let worst = 0;
|
|
103
|
+
let at = -1;
|
|
104
|
+
for (let i = a + 1; i < b; i += 1) {
|
|
105
|
+
const u = (keys[i][0] - keys[a][0]) / (keys[b][0] - keys[a][0]);
|
|
106
|
+
const start = dims(keys[a]);
|
|
107
|
+
const end = dims(keys[b]);
|
|
108
|
+
const error = Math.max(...dims(keys[i]).map((v, d) => Math.abs(v - lerp(start[d], end[d], u))));
|
|
109
|
+
if (error > worst) {
|
|
110
|
+
worst = error;
|
|
111
|
+
at = i;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (worst > tolerance) {
|
|
115
|
+
keep.add(at);
|
|
116
|
+
walk(a, at);
|
|
117
|
+
walk(at, b);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
walk(0, keys.length - 1);
|
|
121
|
+
return keys.filter((_, i) => keep.has(i));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
class Scene {
|
|
125
|
+
constructor(
|
|
126
|
+
name,
|
|
127
|
+
{
|
|
128
|
+
asset = `where-lucy-works-${name}`,
|
|
129
|
+
width = W,
|
|
130
|
+
height = H,
|
|
131
|
+
start = START_FRAMES,
|
|
132
|
+
loop = LOOP_FRAMES,
|
|
133
|
+
background = C.soft,
|
|
134
|
+
} = {},
|
|
135
|
+
) {
|
|
136
|
+
this.name = name;
|
|
137
|
+
this.asset = asset;
|
|
138
|
+
this.start = start;
|
|
139
|
+
this.loop = loop;
|
|
140
|
+
this.commands = [];
|
|
141
|
+
this.tracks = new Map();
|
|
142
|
+
this.parents = new Map();
|
|
143
|
+
this.run('comp.settings', { width, height, frameRate: FPS, duration: (start + loop) / FPS, background });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
run(command, params) {
|
|
147
|
+
this.commands.push({ command, params });
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
shape(name, kind, size, position, { fill, stroke, strokeWidth, radius } = {}) {
|
|
151
|
+
this.run('layer.newShape', {
|
|
152
|
+
kind,
|
|
153
|
+
name,
|
|
154
|
+
size,
|
|
155
|
+
position,
|
|
156
|
+
...(fill ? { fill } : { fillType: 'none' }),
|
|
157
|
+
...(stroke ? { stroke, strokeWidth: strokeWidth ?? 1 } : { strokeType: 'none' }),
|
|
158
|
+
});
|
|
159
|
+
if (kind === 'rounded') this.set(name, RECT.roundness, radius ?? 8);
|
|
160
|
+
return name;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** One more shape on a layer, in the layer's own space. It becomes the layer's newest group. */
|
|
164
|
+
add(layer, kind, size, position, { fill, stroke, strokeWidth, radius } = {}) {
|
|
165
|
+
this.run('shape.newShape', {
|
|
166
|
+
layer,
|
|
167
|
+
kind,
|
|
168
|
+
size,
|
|
169
|
+
position,
|
|
170
|
+
space: 'layer',
|
|
171
|
+
...(fill ? { fill } : { fillType: 'none' }),
|
|
172
|
+
...(stroke ? { stroke, strokeWidth: strokeWidth ?? 1 } : { strokeType: 'none' }),
|
|
173
|
+
});
|
|
174
|
+
if (kind === 'rounded') this.set(layer, RECT.roundness, radius ?? 8);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
path(name, vertices, { closed = true, fill, stroke, strokeWidth, inTangents, outTangents } = {}) {
|
|
178
|
+
this.run('layer.newShape', { kind: 'none', name, position: [0, 0], fillType: 'none', strokeType: 'none' });
|
|
179
|
+
this.addPath(name, vertices, { closed, fill, stroke, strokeWidth, inTangents, outTangents });
|
|
180
|
+
return name;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
addPath(layer, vertices, { closed = true, fill, stroke, strokeWidth, inTangents, outTangents } = {}) {
|
|
184
|
+
this.run('shape.newPath', {
|
|
185
|
+
layer,
|
|
186
|
+
vertices,
|
|
187
|
+
closed,
|
|
188
|
+
space: 'layer',
|
|
189
|
+
...(inTangents ? { inTangents } : {}),
|
|
190
|
+
...(outTangents ? { outTangents } : {}),
|
|
191
|
+
fill: fill ?? false,
|
|
192
|
+
...(stroke ? { stroke, strokeWidth: strokeWidth ?? 1 } : { strokeType: 'none' }),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
text(name, text, position, size, fill, { justify = 'left', font = 'Inter', style } = {}) {
|
|
197
|
+
this.run('layer.newText', { text, name, position, size, fill, justify, font, ...(style ? { style } : {}) });
|
|
198
|
+
return name;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
set(layer, path, value) {
|
|
202
|
+
this.run('prop.set', { layer, path, value });
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
key(layer, path, frame, value) {
|
|
206
|
+
const id = `${layer}\n${path}`;
|
|
207
|
+
if (!this.tracks.has(id)) this.tracks.set(id, { layer, path, keys: new Map() });
|
|
208
|
+
this.tracks.get(id).keys.set(frame, value);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
parent(children, parent) {
|
|
212
|
+
children.forEach((child) => this.parents.set(child, parent));
|
|
213
|
+
this.run('layer.setParent', { layers: children, parent, compensate: true });
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
opacityTrack(layer) {
|
|
217
|
+
return this.tracks.get(`${layer}\n${OPACITY}`)?.keys;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
opacityAt(layer, frame) {
|
|
221
|
+
const keys = this.opacityTrack(layer);
|
|
222
|
+
if (!keys) return 100;
|
|
223
|
+
const sorted = [...keys.entries()].sort((a, b) => a[0] - b[0]);
|
|
224
|
+
if (frame <= sorted[0][0]) return sorted[0][1];
|
|
225
|
+
for (let i = 1; i < sorted.length; i += 1) {
|
|
226
|
+
if (frame <= sorted[i][0]) {
|
|
227
|
+
const [t0, v0] = sorted[i - 1];
|
|
228
|
+
const [t1, v1] = sorted[i];
|
|
229
|
+
return lerp(v0, v1, (frame - t0) / (t1 - t0));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return sorted[sorted.length - 1][1];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Lottie parents pass on transforms but not opacity, so a group fades by fading each of its members. */
|
|
236
|
+
inheritOpacity() {
|
|
237
|
+
const merged = [];
|
|
238
|
+
for (const layer of this.parents.keys()) {
|
|
239
|
+
const chain = [];
|
|
240
|
+
for (let p = this.parents.get(layer); p; p = this.parents.get(p)) if (this.opacityTrack(p)) chain.push(p);
|
|
241
|
+
if (chain.length) {
|
|
242
|
+
const frames = new Set([layer, ...chain].flatMap((l) => [...(this.opacityTrack(l)?.keys() ?? [])]));
|
|
243
|
+
const keys = new Map(
|
|
244
|
+
[...frames].map((f) => [
|
|
245
|
+
f,
|
|
246
|
+
[layer, ...chain].reduce((v, l) => (v * this.opacityAt(l, f)) / 100, 100),
|
|
247
|
+
]),
|
|
248
|
+
);
|
|
249
|
+
merged.push([layer, keys]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
for (const [layer, keys] of merged) this.tracks.set(`${layer}\n${OPACITY}`, { layer, path: OPACITY, keys });
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Pops a layer in with a spring, about its own anchor. */
|
|
256
|
+
pop(layer, frame, { from = 72, response, damping } = {}) {
|
|
257
|
+
for (let f = 0; f <= 44; f += 2) {
|
|
258
|
+
const v = spring(f / FPS, response, damping);
|
|
259
|
+
const s = lerp(from, 100, v);
|
|
260
|
+
this.key(layer, 'transform/scale', frame + f, [s, s, 100]);
|
|
261
|
+
this.key(layer, 'transform/opacity', frame + f, Math.min(100, v * 160));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
fade(layer, from, to, a, b) {
|
|
266
|
+
this.key(layer, 'transform/opacity', a, from);
|
|
267
|
+
this.key(layer, 'transform/opacity', b, to);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
finish() {
|
|
271
|
+
this.inheritOpacity();
|
|
272
|
+
for (const { layer, path, keys } of this.tracks.values()) {
|
|
273
|
+
const sorted = [...keys.entries()].sort((a, b) => a[0] - b[0]);
|
|
274
|
+
for (const [frame, value] of simplify(sorted, TOLERANCE[path] ?? 0.05)) {
|
|
275
|
+
this.run('prop.addKey', { layer, path, time: seconds(frame), value });
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
this.run('markers.set', { new: true, time: 0, duration: this.start / FPS, comment: 'start' });
|
|
279
|
+
this.run('markers.set', { new: true, time: this.start / FPS, duration: this.loop / FPS, comment: 'loop' });
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function phone(s, { received } = {}) {
|
|
284
|
+
s.shape('Phone body', 'rounded', [39, 71], [PHONE.x, PHONE.y], {
|
|
285
|
+
fill: C.white,
|
|
286
|
+
stroke: C.ink,
|
|
287
|
+
strokeWidth: 3,
|
|
288
|
+
radius: 10,
|
|
289
|
+
});
|
|
290
|
+
s.shape('Phone notch', 'rounded', [14, 3], [PHONE.x, PHONE.y - 28], { fill: C.ink, radius: 1.5 });
|
|
291
|
+
s.shape('Phone message', 'rounded', [22, 9], [PHONE.x + 3, PHONE.y - 15], { fill: C.orange, radius: 4 });
|
|
292
|
+
s.shape('Phone reply', 'rounded', [26, 12], [PHONE.x - 1, PHONE.y - 1], { fill: C.orangeSoft, radius: 4 });
|
|
293
|
+
if (received !== undefined) {
|
|
294
|
+
s.shape('Phone file', 'rounded', [18, 9], [PHONE.x - 5, PHONE.y + 13], { fill: C.orange, radius: 3 });
|
|
295
|
+
s.pop('Phone file', received, { from: 40 });
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function linkDots(s, color, opacity) {
|
|
300
|
+
s.shape('Link', 'ellipse', [3, 3], bezier(ARC.from, ARC.via, ARC.to, 0), { fill: color });
|
|
301
|
+
const [x0, y0] = bezier(ARC.from, ARC.via, ARC.to, 0);
|
|
302
|
+
for (let i = 1; i <= 6; i += 1) {
|
|
303
|
+
const [x, y] = bezier(ARC.from, ARC.via, ARC.to, i / 6);
|
|
304
|
+
s.run('shape.newShape', {
|
|
305
|
+
layer: 'Link',
|
|
306
|
+
kind: 'ellipse',
|
|
307
|
+
size: [3, 3],
|
|
308
|
+
position: [x - x0, y - y0],
|
|
309
|
+
space: 'layer',
|
|
310
|
+
fill: color,
|
|
311
|
+
strokeType: 'none',
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
s.set('Link', 'transform/opacity', opacity);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* The comet along the link. Each pass takes one LOOP_FRAMES, so a pass ends exactly where the loop begins.
|
|
319
|
+
* `from` and `to` are frames on whole passes.
|
|
320
|
+
*/
|
|
321
|
+
function comet(s, name, { from = 0, to = TOTAL, reversed = false } = {}) {
|
|
322
|
+
const parts = 5;
|
|
323
|
+
for (let p = 0; p < parts; p += 1) {
|
|
324
|
+
const layer = `${name} ${p + 1}`;
|
|
325
|
+
const radius = 7 - p * 1.1;
|
|
326
|
+
s.shape(layer, 'ellipse', [radius, radius], ARC.from, { fill: C.orange });
|
|
327
|
+
s.run('layer.timing', { layers: [layer], in: seconds(from), out: seconds(to) });
|
|
328
|
+
const lag = 3 * p;
|
|
329
|
+
for (let f = from; f <= to; f += 4) {
|
|
330
|
+
const phase = (f - from + LOOP_FRAMES * 4 - lag) % LOOP_FRAMES;
|
|
331
|
+
const u = phase / LOOP_FRAMES;
|
|
332
|
+
const point = bezier(ARC.from, ARC.via, ARC.to, reversed ? 1 - u : u);
|
|
333
|
+
const edge = Math.min(u, 1 - u);
|
|
334
|
+
const peak = 100 - p * 18;
|
|
335
|
+
s.key(layer, 'transform/position', f, [point[0], point[1], 0]);
|
|
336
|
+
// The tail is hidden for as long as it lags, so the whole comet is gone at the seam and on the resting frame.
|
|
337
|
+
s.key(layer, 'transform/opacity', f, edge < 0.06 + lag / LOOP_FRAMES ? 0 : peak);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
function mark(s, name, center, size, data) {
|
|
343
|
+
const unit = size / 16;
|
|
344
|
+
s.run('layer.newShape', {
|
|
345
|
+
kind: 'none',
|
|
346
|
+
name,
|
|
347
|
+
position: [center[0], center[1]],
|
|
348
|
+
fillType: 'none',
|
|
349
|
+
strokeType: 'none',
|
|
350
|
+
});
|
|
351
|
+
const place = (x, y) => [round((x - 8) * unit), round((y - 8) * unit)];
|
|
352
|
+
for (const [d, fill] of data) {
|
|
353
|
+
for (const contour of d.split(/(?=M)/).filter(Boolean)) {
|
|
354
|
+
const tokens = contour.match(/[MCZ]|-?\d*\.?\d+(?:e-?\d+)?/g);
|
|
355
|
+
const nums = tokens.filter((t) => !/[MCZ]/.test(t)).map(Number);
|
|
356
|
+
const vertices = [place(nums[0], nums[1])];
|
|
357
|
+
const raw = [[nums[0], nums[1]]];
|
|
358
|
+
const inTangents = [[0, 0]];
|
|
359
|
+
const outTangents = [[0, 0]];
|
|
360
|
+
for (let i = 2; i + 5 < nums.length; i += 6) {
|
|
361
|
+
const last = raw[raw.length - 1];
|
|
362
|
+
outTangents[outTangents.length - 1] = [
|
|
363
|
+
round((nums[i] - last[0]) * unit),
|
|
364
|
+
round((nums[i + 1] - last[1]) * unit),
|
|
365
|
+
];
|
|
366
|
+
raw.push([nums[i + 4], nums[i + 5]]);
|
|
367
|
+
vertices.push(place(nums[i + 4], nums[i + 5]));
|
|
368
|
+
inTangents.push([round((nums[i + 2] - nums[i + 4]) * unit), round((nums[i + 3] - nums[i + 5]) * unit)]);
|
|
369
|
+
outTangents.push([0, 0]);
|
|
370
|
+
}
|
|
371
|
+
// A closing curve that lands on the first point folds into it.
|
|
372
|
+
const first = raw[0];
|
|
373
|
+
const last = raw[raw.length - 1];
|
|
374
|
+
if (raw.length > 1 && Math.hypot(first[0] - last[0], first[1] - last[1]) < 1e-3) {
|
|
375
|
+
inTangents[0] = inTangents.pop();
|
|
376
|
+
vertices.pop();
|
|
377
|
+
outTangents.pop();
|
|
378
|
+
}
|
|
379
|
+
s.addPath(name, vertices, { closed: true, fill, inTangents, outTangents });
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// The Clockbook mark, the same artwork as components/Logo.tsx.
|
|
385
|
+
const LOGO = JSON.parse(readFileSync(join(HERE, 'mark.json'), 'utf8'));
|
|
386
|
+
const MARK = [
|
|
387
|
+
[LOGO.back, '#FFCFB3'],
|
|
388
|
+
[LOGO.face, C.orange],
|
|
389
|
+
[LOGO.hands, C.white],
|
|
390
|
+
];
|
|
391
|
+
|
|
392
|
+
// The logo animations. Frames 0 to MARK_CONTENT bring the logo itself in, MARK_CONTENT to MARK_START bring in what
|
|
393
|
+
// is inside it, and from MARK_START it loops. The app starts at MARK_CONTENT when the logo is already on screen and
|
|
394
|
+
// Lucy moves on to something else, so only the inside changes.
|
|
395
|
+
const MARK_CONTENT = 40;
|
|
396
|
+
const MARK_START = 80;
|
|
397
|
+
const MARK_LOOP = 144;
|
|
398
|
+
const MARK_END = MARK_START + MARK_LOOP;
|
|
399
|
+
const LOGO_SIZE = 64;
|
|
400
|
+
const LOGO_UNIT = LOGO_SIZE / 18;
|
|
401
|
+
const STROKE_CAP = 'contents/group/contents/stroke/cap';
|
|
402
|
+
const STROKE_JOIN = 'contents/group/contents/stroke/join';
|
|
403
|
+
|
|
404
|
+
/** Logo units (the artwork is 16 across) to pixels in the animation. */
|
|
405
|
+
const u = (v) => round(v * LOGO_UNIT);
|
|
406
|
+
/** A point given in logo units from its centre. */
|
|
407
|
+
const logoAt = (x, y) => [LOGO_SIZE / 2 + x * LOGO_UNIT, LOGO_SIZE / 2 + y * LOGO_UNIT];
|
|
408
|
+
const easeOut = (t) => 1 - (1 - clamp(t)) ** 3;
|
|
409
|
+
const easeInOut = (t) => (t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2);
|
|
410
|
+
const LOGO_PIVOT = () => logoAt(LOGO.pivot[0] - 8, LOGO.pivot[1] - 8);
|
|
411
|
+
|
|
412
|
+
/** Calls `at(frame, r, v)` across the loop: r in frames from its start, v from 0 to 1. */
|
|
413
|
+
function everyLoopFrame(at, step = 2) {
|
|
414
|
+
for (let f = MARK_START; f <= MARK_END; f += step) at(f, f - MARK_START, (f - MARK_START) / MARK_LOOP);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/** Springs a part in over the content frames, landing exactly on the frame the loop starts. */
|
|
418
|
+
function iconIn(s, layer, peak = 100) {
|
|
419
|
+
const frames = MARK_START - MARK_CONTENT;
|
|
420
|
+
for (let f = 0; f <= frames; f += 2) {
|
|
421
|
+
const v = f === frames ? 1 : spring(f / FPS, 0.36, 0.6);
|
|
422
|
+
const scale = lerp(55, 100, v);
|
|
423
|
+
s.key(layer, 'transform/scale', MARK_CONTENT + f, [scale, scale, 100]);
|
|
424
|
+
s.key(layer, OPACITY, MARK_CONTENT + f, Math.min(peak, v * 1.8 * peak));
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** A clock hand: one stroked curve on its own layer, turning about the point where the hands meet. */
|
|
429
|
+
function hand(s, name, d) {
|
|
430
|
+
const [x0, y0, c1x, c1y, c2x, c2y, x1, y1] = d.match(/-?\d*\.?\d+/g).map(Number);
|
|
431
|
+
const [px, py] = LOGO.pivot;
|
|
432
|
+
s.run('layer.newShape', { kind: 'none', name, position: LOGO_PIVOT(), fillType: 'none', strokeType: 'none' });
|
|
433
|
+
s.addPath(
|
|
434
|
+
name,
|
|
435
|
+
[
|
|
436
|
+
[u(x0 - px), u(y0 - py)],
|
|
437
|
+
[u(x1 - px), u(y1 - py)],
|
|
438
|
+
],
|
|
439
|
+
{
|
|
440
|
+
closed: false,
|
|
441
|
+
stroke: C.white,
|
|
442
|
+
strokeWidth: u(LOGO.handWidth),
|
|
443
|
+
inTangents: [
|
|
444
|
+
[0, 0],
|
|
445
|
+
[u(c2x - x1), u(c2y - y1)],
|
|
446
|
+
],
|
|
447
|
+
outTangents: [
|
|
448
|
+
[u(c1x - x0), u(c1y - y0)],
|
|
449
|
+
[0, 0],
|
|
450
|
+
],
|
|
451
|
+
},
|
|
452
|
+
);
|
|
453
|
+
s.set(name, STROKE_CAP, 1);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function hands(s) {
|
|
457
|
+
hand(s, 'Hour', LOGO.hour);
|
|
458
|
+
hand(s, 'Minute', LOGO.minute);
|
|
459
|
+
for (const name of ['Hour', 'Minute']) s.fade(name, 0, 100, MARK_CONTENT, MARK_CONTENT + 10);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/** A stroked line on a layer of its own, with round ends. */
|
|
463
|
+
function line(s, name, position, vertices, tangents = {}, strokeWidth = u(1.05)) {
|
|
464
|
+
s.run('layer.newShape', { kind: 'none', name, position, fillType: 'none', strokeType: 'none' });
|
|
465
|
+
s.addPath(name, vertices, { closed: false, stroke: C.white, strokeWidth, ...tangents });
|
|
466
|
+
s.set(name, STROKE_CAP, 1);
|
|
467
|
+
s.set(name, STROKE_JOIN, 1);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/** Thinking: the minute hand keeps rewinding, the same "time back" idea as the animated logo on Home. */
|
|
471
|
+
function thinkIcon(s) {
|
|
472
|
+
hands(s);
|
|
473
|
+
for (let f = MARK_CONTENT; f <= MARK_START; f += 2) {
|
|
474
|
+
const left = 1 - easeOut((f - MARK_CONTENT) / (MARK_START - MARK_CONTENT));
|
|
475
|
+
s.key('Minute', 'transform/rotation', f, 300 * left);
|
|
476
|
+
s.key('Hour', 'transform/rotation', f, 50 * left);
|
|
477
|
+
}
|
|
478
|
+
everyLoopFrame((f, r, v) => {
|
|
479
|
+
s.key('Minute', 'transform/rotation', f, -360 * easeInOut(v));
|
|
480
|
+
s.key('Hour', 'transform/rotation', f, -8 * ((1 - Math.cos(v * 2 * Math.PI)) / 2));
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** Writing: lines of text fill in one after another. */
|
|
485
|
+
function writeIcon(s) {
|
|
486
|
+
const left = -4.6;
|
|
487
|
+
[
|
|
488
|
+
[-2.7, 8.8],
|
|
489
|
+
[0, 9.2],
|
|
490
|
+
[2.7, 5.6],
|
|
491
|
+
].forEach(([y, width], i) => {
|
|
492
|
+
const size = [u(width), u(1.15)];
|
|
493
|
+
const center = logoAt(left + width / 2, y);
|
|
494
|
+
const ghost = `Line ${i + 1} ghost`;
|
|
495
|
+
const ink = `Line ${i + 1}`;
|
|
496
|
+
s.shape(ghost, 'rounded', size, center, { fill: C.white, radius: u(0.57) });
|
|
497
|
+
iconIn(s, ghost, 38);
|
|
498
|
+
s.shape(ink, 'rounded', size, center, { fill: C.white, radius: u(0.57) });
|
|
499
|
+
s.set(ink, 'transform/anchor', [-u(width / 2), 0, 0]);
|
|
500
|
+
s.set(ink, 'transform/position', [...logoAt(left, y), 0]);
|
|
501
|
+
const from = 8 + 36 * i;
|
|
502
|
+
everyLoopFrame((f, r) => {
|
|
503
|
+
s.key(ink, 'transform/scale', f, [r >= 136 ? 0 : smooth((r - from) / 32) * 100, 100, 100]);
|
|
504
|
+
s.key(ink, OPACITY, f, r >= 136 ? 100 : 100 * (1 - clamp((r - 114) / 18)));
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/** A piece of a circle as one curve: start point, end point and the two handles. */
|
|
510
|
+
function arc(radius, fromDeg, toDeg) {
|
|
511
|
+
const a0 = (fromDeg * Math.PI) / 180;
|
|
512
|
+
const a1 = (toDeg * Math.PI) / 180;
|
|
513
|
+
const k = (4 / 3) * Math.tan((a1 - a0) / 4) * radius;
|
|
514
|
+
return {
|
|
515
|
+
vertices: [
|
|
516
|
+
[u(radius * Math.cos(a0)), u(radius * Math.sin(a0))],
|
|
517
|
+
[u(radius * Math.cos(a1)), u(radius * Math.sin(a1))],
|
|
518
|
+
],
|
|
519
|
+
outTangents: [
|
|
520
|
+
[u(-Math.sin(a0) * k), u(Math.cos(a0) * k)],
|
|
521
|
+
[0, 0],
|
|
522
|
+
],
|
|
523
|
+
inTangents: [
|
|
524
|
+
[0, 0],
|
|
525
|
+
[u(Math.sin(a1) * k), u(-Math.cos(a1) * k)],
|
|
526
|
+
],
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** Making a call: a handset that rings, with the signal going out from it. */
|
|
531
|
+
function callIcon(s) {
|
|
532
|
+
s.run('layer.newShape', {
|
|
533
|
+
kind: 'none',
|
|
534
|
+
name: 'Handset',
|
|
535
|
+
position: logoAt(-0.6, 0.6),
|
|
536
|
+
fillType: 'none',
|
|
537
|
+
strokeType: 'none',
|
|
538
|
+
});
|
|
539
|
+
s.addPath(
|
|
540
|
+
'Handset',
|
|
541
|
+
[
|
|
542
|
+
[u(-2.7), u(-2.9)],
|
|
543
|
+
[u(2.9), u(2.7)],
|
|
544
|
+
],
|
|
545
|
+
{
|
|
546
|
+
closed: false,
|
|
547
|
+
stroke: C.white,
|
|
548
|
+
strokeWidth: u(2),
|
|
549
|
+
outTangents: [
|
|
550
|
+
[u(-1), u(3.1)],
|
|
551
|
+
[0, 0],
|
|
552
|
+
],
|
|
553
|
+
inTangents: [
|
|
554
|
+
[0, 0],
|
|
555
|
+
[u(-3.1), u(1)],
|
|
556
|
+
],
|
|
557
|
+
},
|
|
558
|
+
);
|
|
559
|
+
s.set('Handset', STROKE_CAP, 1);
|
|
560
|
+
s.add('Handset', 'ellipse', [u(3.1), u(3.1)], [u(-2.7), u(-2.9)], { fill: C.white });
|
|
561
|
+
s.add('Handset', 'ellipse', [u(3.1), u(3.1)], [u(2.9), u(2.7)], { fill: C.white });
|
|
562
|
+
iconIn(s, 'Handset');
|
|
563
|
+
const waves = [
|
|
564
|
+
['Wave 1', 3.4, 30],
|
|
565
|
+
['Wave 2', 5.5, 40],
|
|
566
|
+
];
|
|
567
|
+
for (const [name, radius] of waves) {
|
|
568
|
+
const { vertices, ...tangents } = arc(radius, -80, -10);
|
|
569
|
+
line(s, name, logoAt(-0.4, 0.4), vertices, tangents);
|
|
570
|
+
iconIn(s, name);
|
|
571
|
+
}
|
|
572
|
+
for (const pass of [0, 72]) {
|
|
573
|
+
for (const [name, , off] of waves) {
|
|
574
|
+
const on = [
|
|
575
|
+
[0, 100],
|
|
576
|
+
[8, 100],
|
|
577
|
+
[20, 0],
|
|
578
|
+
[off, 0],
|
|
579
|
+
[off + 8, 100],
|
|
580
|
+
[72, 100],
|
|
581
|
+
];
|
|
582
|
+
for (const [r, value] of on) s.key(name, OPACITY, MARK_START + pass + r, value);
|
|
583
|
+
}
|
|
584
|
+
for (let r = 28; r <= 60; r += 1) {
|
|
585
|
+
const envelope = Math.sin((Math.PI * (r - 28)) / 32);
|
|
586
|
+
s.key(
|
|
587
|
+
'Handset',
|
|
588
|
+
'transform/rotation',
|
|
589
|
+
MARK_START + pass + r,
|
|
590
|
+
8 * envelope * Math.sin((2 * Math.PI * r) / 13),
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
s.key('Handset', 'transform/rotation', MARK_START + pass, 0);
|
|
594
|
+
s.key('Handset', 'transform/rotation', MARK_START + pass + 72, 0);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/** Checking the calendar: a page where the marked day moves along. */
|
|
599
|
+
function calendarIcon(s) {
|
|
600
|
+
s.shape('Page', 'rounded', [u(10), u(9.6)], logoAt(0, 0.1), {
|
|
601
|
+
stroke: C.white,
|
|
602
|
+
strokeWidth: u(1.05),
|
|
603
|
+
radius: u(1.6),
|
|
604
|
+
});
|
|
605
|
+
s.add('Page', 'rounded', [u(10), u(2.9)], [0, u(-3.35)], { fill: C.white, radius: u(1.2) });
|
|
606
|
+
iconIn(s, 'Page');
|
|
607
|
+
const cells = [
|
|
608
|
+
[-2.7, 0.3],
|
|
609
|
+
[0, 0.3],
|
|
610
|
+
[2.7, 0.3],
|
|
611
|
+
[2.7, 2.9],
|
|
612
|
+
[0, 2.9],
|
|
613
|
+
[-2.7, 2.9],
|
|
614
|
+
];
|
|
615
|
+
s.shape('Days', 'ellipse', [u(1.3), u(1.3)], logoAt(...cells[0]), { fill: C.white });
|
|
616
|
+
for (const [x, y] of cells.slice(1)) {
|
|
617
|
+
s.add('Days', 'ellipse', [u(1.3), u(1.3)], [u(x - cells[0][0]), u(y - cells[0][1])], { fill: C.white });
|
|
618
|
+
}
|
|
619
|
+
iconIn(s, 'Days', 55);
|
|
620
|
+
s.shape('Today', 'ellipse', [u(2.5), u(2.5)], logoAt(...cells[0]), { fill: C.white });
|
|
621
|
+
iconIn(s, 'Today');
|
|
622
|
+
everyLoopFrame((f, r) => {
|
|
623
|
+
const k = Math.min(5, Math.floor(r / 24));
|
|
624
|
+
const v = r >= 144 ? 1 : smooth((r - k * 24) / 14);
|
|
625
|
+
const from = cells[r >= 144 ? 0 : k];
|
|
626
|
+
const to = cells[(k + 1) % 6];
|
|
627
|
+
const [x, y] = r >= 144 ? logoAt(...cells[0]) : logoAt(lerp(from[0], to[0], v), lerp(from[1], to[1], v));
|
|
628
|
+
const bump = r >= 144 ? 100 : 100 + 24 * Math.sin(Math.PI * v);
|
|
629
|
+
s.key('Today', 'transform/position', f, [x, y, 0]);
|
|
630
|
+
s.key('Today', 'transform/scale', f, [bump, bump, 100]);
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/** Looking through email: an envelope that opens, and a letter that comes up out of it. */
|
|
635
|
+
function emailIcon(s) {
|
|
636
|
+
s.shape('Letter', 'rounded', [u(7.4), u(5.2)], logoAt(0, -0.1), { fill: C.white, radius: u(0.7) });
|
|
637
|
+
iconIn(s, 'Letter');
|
|
638
|
+
s.shape('Envelope', 'rounded', [u(10.6), u(7.4)], logoAt(0, 0.4), {
|
|
639
|
+
fill: C.orange,
|
|
640
|
+
stroke: C.white,
|
|
641
|
+
strokeWidth: u(1.05),
|
|
642
|
+
radius: u(1.2),
|
|
643
|
+
});
|
|
644
|
+
iconIn(s, 'Envelope');
|
|
645
|
+
line(s, 'Flap', logoAt(0, -3.3), [
|
|
646
|
+
[u(-4.9), u(0.25)],
|
|
647
|
+
[0, u(4.2)],
|
|
648
|
+
[u(4.9), u(0.25)],
|
|
649
|
+
]);
|
|
650
|
+
iconIn(s, 'Flap');
|
|
651
|
+
everyLoopFrame((f, r) => {
|
|
652
|
+
const open = smooth((r - 14) / 30) - smooth((r - 96) / 30);
|
|
653
|
+
s.key('Flap', 'transform/scale', f, [100, 100 - 200 * open, 100]);
|
|
654
|
+
const up = smooth((r - 36) / 24) - smooth((r - 82) / 22);
|
|
655
|
+
s.key('Letter', 'transform/position', f, [...logoAt(0, -0.1 - 2.9 * up), 0]);
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** Looking it up: a magnifying glass moving across the logo. */
|
|
660
|
+
function searchIcon(s) {
|
|
661
|
+
s.run('layer.newShape', {
|
|
662
|
+
kind: 'none',
|
|
663
|
+
name: 'Lens',
|
|
664
|
+
position: logoAt(0, 0),
|
|
665
|
+
fillType: 'none',
|
|
666
|
+
strokeType: 'none',
|
|
667
|
+
});
|
|
668
|
+
s.addPath(
|
|
669
|
+
'Lens',
|
|
670
|
+
[
|
|
671
|
+
[u(1.35), u(1.35)],
|
|
672
|
+
[u(4), u(4)],
|
|
673
|
+
],
|
|
674
|
+
{ closed: false, stroke: C.white, strokeWidth: u(1.9) },
|
|
675
|
+
);
|
|
676
|
+
s.set('Lens', STROKE_CAP, 1);
|
|
677
|
+
s.add('Lens', 'ellipse', [u(6.6), u(6.6)], [u(-1.1), u(-1.1)], { stroke: C.white, strokeWidth: u(1.4) });
|
|
678
|
+
iconIn(s, 'Lens');
|
|
679
|
+
everyLoopFrame((f, r, v) => {
|
|
680
|
+
const [x, y] = logoAt(1.4 * Math.sin(2 * Math.PI * v), 0.9 * Math.sin(4 * Math.PI * v));
|
|
681
|
+
s.key('Lens', 'transform/position', f, [x, y, 0]);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/** Sending a message: the bubble flies off and a new one takes its place. */
|
|
686
|
+
function messageIcon(s) {
|
|
687
|
+
const rest = [-0.3, -0.4];
|
|
688
|
+
s.shape('Bubble', 'rounded', [u(9.6), u(6.8)], logoAt(...rest), { fill: C.white, radius: u(2.4) });
|
|
689
|
+
s.addPath(
|
|
690
|
+
'Bubble',
|
|
691
|
+
[
|
|
692
|
+
[u(-3.2), u(2.6)],
|
|
693
|
+
[u(-4.2), u(5.2)],
|
|
694
|
+
[u(-0.8), u(3.1)],
|
|
695
|
+
],
|
|
696
|
+
{ closed: true, fill: C.white },
|
|
697
|
+
);
|
|
698
|
+
for (const x of [-2.4, 0, 2.4]) s.add('Bubble', 'ellipse', [u(1.5), u(1.5)], [u(x), 0], { fill: C.orange });
|
|
699
|
+
iconIn(s, 'Bubble');
|
|
700
|
+
everyLoopFrame((f, r) => {
|
|
701
|
+
const away = r < 62 ? smooth((r - 24) / 38) : 0;
|
|
702
|
+
const [x, y] = logoAt(rest[0] + 4.2 * away, rest[1] - 4.6 * away);
|
|
703
|
+
const back = r >= 110 ? 1 : spring((r - 66) / FPS, 0.42, 0.62);
|
|
704
|
+
let scale = 100 - 38 * away;
|
|
705
|
+
let opacity = 100 * (1 - clamp((r - 34) / 28));
|
|
706
|
+
if (r >= 62) {
|
|
707
|
+
scale = r < 66 ? 30 : lerp(30, 100, back);
|
|
708
|
+
opacity = r < 66 ? 0 : Math.min(100, back * 200);
|
|
709
|
+
}
|
|
710
|
+
s.key('Bubble', 'transform/position', f, [x, y, 0]);
|
|
711
|
+
s.key('Bubble', 'transform/scale', f, [scale, scale, 100]);
|
|
712
|
+
s.key('Bubble', OPACITY, f, opacity);
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/** Working through the details: the hands race forward inside a turning ring of clock ticks. */
|
|
717
|
+
function detailsIcon(s) {
|
|
718
|
+
const diameter = 11.6;
|
|
719
|
+
s.shape('Ticks', 'ellipse', [u(diameter), u(diameter)], logoAt(0, 0), { stroke: C.white, strokeWidth: u(1) });
|
|
720
|
+
s.run('shape.dashes.add', { layer: 'Ticks' });
|
|
721
|
+
s.set('Ticks', DASHES.dash, u(1.1));
|
|
722
|
+
s.set('Ticks', DASHES.gap, round((Math.PI * u(diameter)) / 12 - u(1.1)));
|
|
723
|
+
iconIn(s, 'Ticks', 70);
|
|
724
|
+
s.key('Ticks', 'transform/rotation', MARK_START, 0);
|
|
725
|
+
s.key('Ticks', 'transform/rotation', MARK_END, 120);
|
|
726
|
+
hands(s);
|
|
727
|
+
for (const name of ['Hour', 'Minute']) s.set(name, 'transform/scale', [78, 78, 100]);
|
|
728
|
+
for (let f = MARK_CONTENT; f <= MARK_START; f += 2) {
|
|
729
|
+
const left = 1 - easeOut((f - MARK_CONTENT) / (MARK_START - MARK_CONTENT));
|
|
730
|
+
s.key('Minute', 'transform/rotation', f, -240 * left);
|
|
731
|
+
s.key('Hour', 'transform/rotation', f, -60 * left);
|
|
732
|
+
}
|
|
733
|
+
everyLoopFrame((f, r, v) => {
|
|
734
|
+
s.key('Minute', 'transform/rotation', f, 1080 * easeInOut(v));
|
|
735
|
+
s.key('Hour', 'transform/rotation', f, 360 * easeInOut(v));
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/** Connecting or waiting its turn: the clock waits while three dots gather and spread around it. */
|
|
740
|
+
function connectIcon(s) {
|
|
741
|
+
hands(s);
|
|
742
|
+
for (const name of ['Hour', 'Minute']) s.set(name, 'transform/scale', [72, 72, 100]);
|
|
743
|
+
[1.9, 1.5, 1.1].forEach((size, i) => {
|
|
744
|
+
const name = `Dot ${i + 1}`;
|
|
745
|
+
const place = (v) => {
|
|
746
|
+
const angle = 2 * Math.PI * easeInOut((v + i * 0.1) % 1) - Math.PI / 2;
|
|
747
|
+
return logoAt(5.3 * Math.cos(angle), 5.3 * Math.sin(angle));
|
|
748
|
+
};
|
|
749
|
+
s.shape(name, 'ellipse', [u(size), u(size)], place(0), { fill: C.white });
|
|
750
|
+
iconIn(s, name);
|
|
751
|
+
everyLoopFrame((f, r, v) => s.key(name, 'transform/position', f, [...place(v % 1), 0]));
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
const LOGO_ICONS = {
|
|
756
|
+
think: thinkIcon,
|
|
757
|
+
write: writeIcon,
|
|
758
|
+
call: callIcon,
|
|
759
|
+
calendar: calendarIcon,
|
|
760
|
+
email: emailIcon,
|
|
761
|
+
search: searchIcon,
|
|
762
|
+
message: messageIcon,
|
|
763
|
+
details: detailsIcon,
|
|
764
|
+
connect: connectIcon,
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
/** The logo itself, the same in every animation so that changing from one to another only changes what is inside. */
|
|
768
|
+
function logoScene(icon) {
|
|
769
|
+
const name = `lucy-mark-${icon}`;
|
|
770
|
+
const s = new Scene(name, {
|
|
771
|
+
asset: name,
|
|
772
|
+
width: LOGO_SIZE,
|
|
773
|
+
height: LOGO_SIZE,
|
|
774
|
+
start: MARK_START,
|
|
775
|
+
loop: MARK_LOOP,
|
|
776
|
+
background: C.white,
|
|
777
|
+
});
|
|
778
|
+
mark(s, 'Back', logoAt(0, 0), 16 * LOGO_UNIT, [[LOGO.back, C.orange]]);
|
|
779
|
+
mark(s, 'Face', logoAt(0, 0), 16 * LOGO_UNIT, [[LOGO.face, C.orange]]);
|
|
780
|
+
s.set('Back', OPACITY, 25);
|
|
781
|
+
for (let f = 0; f <= 34; f += 2) {
|
|
782
|
+
const v = f === 34 ? 100 : lerp(0, 100, spring(f / FPS, 0.4, 0.62));
|
|
783
|
+
s.key('Back', 'transform/scale', 5 + f, [v, v, 100]);
|
|
784
|
+
}
|
|
785
|
+
s.key('Back', 'transform/rotation', 0, (-MARK_START / MARK_LOOP) * 360);
|
|
786
|
+
s.key('Back', 'transform/rotation', MARK_END, 360);
|
|
787
|
+
s.pop('Face', 0, { from: 30 });
|
|
788
|
+
everyLoopFrame((f, r, v) => {
|
|
789
|
+
const scale = 100 + 3 * ((1 - Math.cos(v * 2 * Math.PI)) / 2);
|
|
790
|
+
s.key('Face', 'transform/scale', f, [scale, scale, 100]);
|
|
791
|
+
}, 4);
|
|
792
|
+
LOGO_ICONS[icon](s);
|
|
793
|
+
s.finish();
|
|
794
|
+
return s;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function chatScene() {
|
|
798
|
+
const s = new Scene('chat');
|
|
799
|
+
const y1 = 44;
|
|
800
|
+
const y2 = 88;
|
|
801
|
+
|
|
802
|
+
s.shape('You bubble', 'rounded', [214, 36], [W - 16 - 107, y1], { fill: C.orange, radius: 15 });
|
|
803
|
+
s.text('You said', 'Book my dentist for Thursday', [W - 16 - 107, y1 + 4.8], 13.5, C.white, {
|
|
804
|
+
justify: 'center',
|
|
805
|
+
style: 'Medium',
|
|
806
|
+
});
|
|
807
|
+
s.parent(['You said'], 'You bubble');
|
|
808
|
+
s.set('You bubble', 'transform/anchor', [107, 18, 0]);
|
|
809
|
+
s.set('You bubble', 'transform/position', [W - 16, y1 + 18, 0]);
|
|
810
|
+
s.pop('You bubble', 6);
|
|
811
|
+
|
|
812
|
+
const avatarX = 29;
|
|
813
|
+
s.shape('Lucy avatar', 'ellipse', [26, 26], [avatarX, y2 + 6], { fill: C.white, stroke: C.line, strokeWidth: 1 });
|
|
814
|
+
mark(s, 'Lucy mark', [avatarX, y2 + 6], 15, MARK);
|
|
815
|
+
s.parent(['Lucy mark'], 'Lucy avatar');
|
|
816
|
+
s.pop('Lucy avatar', 30);
|
|
817
|
+
|
|
818
|
+
const typingX = 68;
|
|
819
|
+
s.shape('Typing bubble', 'rounded', [52, 32], [typingX, y2], {
|
|
820
|
+
fill: C.white,
|
|
821
|
+
stroke: C.line,
|
|
822
|
+
strokeWidth: 1,
|
|
823
|
+
radius: 13,
|
|
824
|
+
});
|
|
825
|
+
const dots = [0, 1, 2].map((i) => {
|
|
826
|
+
const name = `Typing dot ${i + 1}`;
|
|
827
|
+
s.shape(name, 'ellipse', [6, 6], [typingX - 10 + i * 10, y2], { fill: C.muted });
|
|
828
|
+
return name;
|
|
829
|
+
});
|
|
830
|
+
s.parent(dots, 'Typing bubble');
|
|
831
|
+
s.pop('Typing bubble', 32);
|
|
832
|
+
dots.forEach((name, i) => {
|
|
833
|
+
for (let f = 32; f <= 108; f += 3) {
|
|
834
|
+
const wave = (Math.sin((f / FPS) * 7 - i * 0.9) + 1) / 2;
|
|
835
|
+
s.key(name, 'transform/position', f, [-10 + i * 10, -2.5 * wave, 0]);
|
|
836
|
+
s.key(name, 'transform/opacity', f, 35 + 65 * wave);
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
s.run('layer.timing', { layers: ['Typing bubble', ...dots], out: seconds(108) });
|
|
840
|
+
|
|
841
|
+
const replyW = 178;
|
|
842
|
+
const replyX = 42 + replyW / 2;
|
|
843
|
+
s.shape('Lucy bubble', 'rounded', [replyW, 34], [replyX, y2], {
|
|
844
|
+
fill: C.white,
|
|
845
|
+
stroke: C.line,
|
|
846
|
+
strokeWidth: 1,
|
|
847
|
+
radius: 13,
|
|
848
|
+
});
|
|
849
|
+
s.text('Lucy said', 'Done. Thursday at 3 pm.', [replyX, y2 + 4.8], 13.5, C.ink, { justify: 'center' });
|
|
850
|
+
// Lifts off the words left to right, so they stream in with the bubble already at its full size.
|
|
851
|
+
s.shape('Reply cover', 'rect', [replyW - 16, 22], [replyX + (replyW - 16) / 2, y2], { fill: C.white });
|
|
852
|
+
s.set('Reply cover', 'transform/anchor', [(replyW - 16) / 2, 0, 0]);
|
|
853
|
+
s.parent(['Lucy said', 'Reply cover'], 'Lucy bubble');
|
|
854
|
+
s.set('Lucy bubble', 'transform/anchor', [-replyW / 2, 17, 0]);
|
|
855
|
+
s.set('Lucy bubble', 'transform/position', [42, y2 + 17, 0]);
|
|
856
|
+
s.pop('Lucy bubble', 104);
|
|
857
|
+
for (let f = 110; f <= 152; f += 3) {
|
|
858
|
+
const u = smooth((f - 110) / 42);
|
|
859
|
+
s.key('Reply cover', 'transform/scale', f, [(1 - u) * 100, 100, 100]);
|
|
860
|
+
}
|
|
861
|
+
s.finish();
|
|
862
|
+
return s;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
function cloudScene() {
|
|
866
|
+
const s = new Scene('cloud');
|
|
867
|
+
phone(s);
|
|
868
|
+
linkDots(s, C.orange, 28);
|
|
869
|
+
comet(s, 'Comet');
|
|
870
|
+
|
|
871
|
+
const left = DEVICE.x - WINDOW.w / 2;
|
|
872
|
+
const top = DEVICE.y - WINDOW.h / 2;
|
|
873
|
+
const at = (x, y) => [left + x, top + y];
|
|
874
|
+
|
|
875
|
+
s.shape('Window', 'rounded', [WINDOW.w, WINDOW.h], [DEVICE.x, DEVICE.y], {
|
|
876
|
+
fill: C.white,
|
|
877
|
+
stroke: C.line,
|
|
878
|
+
strokeWidth: 1,
|
|
879
|
+
radius: 12,
|
|
880
|
+
});
|
|
881
|
+
const parts = [];
|
|
882
|
+
const part = (name, ...args) => {
|
|
883
|
+
s.shape(name, ...args);
|
|
884
|
+
parts.push(name);
|
|
885
|
+
};
|
|
886
|
+
const label = (name, ...args) => {
|
|
887
|
+
s.text(name, ...args);
|
|
888
|
+
parts.push(name);
|
|
889
|
+
};
|
|
890
|
+
part('Window dot 1', 'ellipse', [6, 6], at(11, 12), { fill: C.dotA });
|
|
891
|
+
part('Window dot 2', 'ellipse', [6, 6], at(20.5, 12), { fill: C.dotB });
|
|
892
|
+
part('Window dot 3', 'ellipse', [6, 6], at(30, 12), { fill: C.dotC });
|
|
893
|
+
part('Address', 'rounded', [125, 15], at(100, 12), { fill: C.soft, radius: 7.5 });
|
|
894
|
+
label('Address text', 'smiledental.com/book', at(44, 15), 8.5, C.muted);
|
|
895
|
+
part('Window divider', 'rect', [WINDOW.w, 1], at(WINDOW.w / 2, 24), { fill: C.line });
|
|
896
|
+
label('Day', 'Thursday', at(10, 43), 11.5, C.ink, { style: 'SemiBold' });
|
|
897
|
+
part('Slot 1', 'rounded', [47, 11], at(33.5, 55), { fill: C.track, radius: 4 });
|
|
898
|
+
part('Slot 2', 'rounded', [47, 11], at(86, 55), { fill: C.track, radius: 4 });
|
|
899
|
+
part('Slot 3', 'rounded', [47, 11], at(138.5, 55), { fill: C.track, radius: 4 });
|
|
900
|
+
part('Slot picked', 'rounded', [47, 11], at(86, 55), {
|
|
901
|
+
fill: C.orangeSoft,
|
|
902
|
+
stroke: C.orange,
|
|
903
|
+
strokeWidth: 1,
|
|
904
|
+
radius: 4,
|
|
905
|
+
});
|
|
906
|
+
part('Button', 'rounded', [152, 23], at(86, 78), { fill: C.orange, radius: 7 });
|
|
907
|
+
label('Button book', 'Book 3 pm', at(86, 81.7), 10.5, C.white, { justify: 'center', style: 'SemiBold' });
|
|
908
|
+
label('Button booked', 'Booked', at(92, 81.7), 10.5, C.white, { justify: 'center', style: 'SemiBold' });
|
|
909
|
+
s.path(
|
|
910
|
+
'Button check',
|
|
911
|
+
[
|
|
912
|
+
[0, 3.5],
|
|
913
|
+
[3.3, 7],
|
|
914
|
+
[9, 0],
|
|
915
|
+
],
|
|
916
|
+
{ closed: false, stroke: C.white, strokeWidth: 1.8 },
|
|
917
|
+
);
|
|
918
|
+
s.set('Button check', 'transform/position', [...at(60, 74.5), 0]);
|
|
919
|
+
parts.push('Button check');
|
|
920
|
+
s.parent(parts, 'Window');
|
|
921
|
+
s.pop('Window', 2, { from: 94, damping: 0.8 });
|
|
922
|
+
|
|
923
|
+
s.pop('Slot picked', 72, { from: 80, response: 0.34, damping: 0.55 });
|
|
924
|
+
for (let f = 124; f <= 144; f += 2) {
|
|
925
|
+
const press = f < 130 ? (f - 124) / 6 : 1 - (f - 130) / 14;
|
|
926
|
+
const v = 100 - 6 * clamp(press);
|
|
927
|
+
s.key('Button', 'transform/scale', f, [v, v, 100]);
|
|
928
|
+
}
|
|
929
|
+
s.fade('Button book', 100, 0, 132, 140);
|
|
930
|
+
s.fade('Button booked', 0, 100, 136, 144);
|
|
931
|
+
s.fade('Button check', 0, 100, 136, 144);
|
|
932
|
+
|
|
933
|
+
const ripple = (name, center, frame) => {
|
|
934
|
+
s.shape(name, 'ellipse', [34, 34], center, { stroke: C.orange, strokeWidth: 1.5 });
|
|
935
|
+
s.key(name, 'transform/scale', frame, [20, 20, 100]);
|
|
936
|
+
s.key(name, 'transform/scale', frame + 27, [100, 100, 100]);
|
|
937
|
+
s.key(name, 'transform/opacity', frame - 1, 0);
|
|
938
|
+
s.key(name, 'transform/opacity', frame, 55);
|
|
939
|
+
s.key(name, 'transform/opacity', frame + 27, 0);
|
|
940
|
+
};
|
|
941
|
+
ripple('Ripple slot', at(86, 55), 70);
|
|
942
|
+
ripple('Ripple button', at(132, 78), 130);
|
|
943
|
+
|
|
944
|
+
s.path(
|
|
945
|
+
'Cursor',
|
|
946
|
+
[
|
|
947
|
+
[0, 0],
|
|
948
|
+
[0, 12.9],
|
|
949
|
+
[3.2, 9.6],
|
|
950
|
+
[5.6, 15],
|
|
951
|
+
[8.2, 13.5],
|
|
952
|
+
[5.8, 8.4],
|
|
953
|
+
[9.8, 8.1],
|
|
954
|
+
],
|
|
955
|
+
{ fill: C.ink, stroke: C.white, strokeWidth: 1 },
|
|
956
|
+
);
|
|
957
|
+
const A = at(132, 38);
|
|
958
|
+
const B = at(86, 55);
|
|
959
|
+
const D = at(134, 78);
|
|
960
|
+
for (let f = 0; f <= 210; f += 2) {
|
|
961
|
+
const p1 = smooth((f - 22) / 44);
|
|
962
|
+
const p2 = smooth((f - 86) / 36);
|
|
963
|
+
const p = [lerp(lerp(A[0], B[0], p1), D[0], p2), lerp(lerp(A[1], B[1], p1), D[1], p2)];
|
|
964
|
+
s.key('Cursor', 'transform/position', f, [p[0], p[1], 0]);
|
|
965
|
+
}
|
|
966
|
+
s.key('Cursor', 'transform/opacity', 0, 0);
|
|
967
|
+
s.key('Cursor', 'transform/opacity', 10, 100);
|
|
968
|
+
s.fade('Cursor', 100, 0, 188, 206);
|
|
969
|
+
for (const c of [70, 130]) {
|
|
970
|
+
s.key('Cursor', 'transform/scale', c - 5, [100, 100, 100]);
|
|
971
|
+
s.key('Cursor', 'transform/scale', c, [82, 82, 100]);
|
|
972
|
+
s.key('Cursor', 'transform/scale', c + 12, [100, 100, 100]);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
const bx = DEVICE.x + 84;
|
|
976
|
+
const by = DEVICE.y - 51;
|
|
977
|
+
s.shape('Cloud badge', 'ellipse', [24, 24], [bx, by], { fill: C.white, stroke: C.line, strokeWidth: 1 });
|
|
978
|
+
s.shape('Cloud', 'ellipse', [8.6, 8.6], [bx - 0.2, by - 1.4], { fill: C.orange });
|
|
979
|
+
for (const [kind, size, position] of [
|
|
980
|
+
['ellipse', [6.4, 6.4], [-3.8, 1.6]],
|
|
981
|
+
['ellipse', [5.6, 5.6], [4, 2]],
|
|
982
|
+
['rect', [8, 4.4], [0, 2.6]],
|
|
983
|
+
]) {
|
|
984
|
+
s.run('shape.newShape', {
|
|
985
|
+
layer: 'Cloud',
|
|
986
|
+
kind,
|
|
987
|
+
size,
|
|
988
|
+
position,
|
|
989
|
+
space: 'layer',
|
|
990
|
+
fill: C.orange,
|
|
991
|
+
strokeType: 'none',
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
s.parent(['Cloud'], 'Cloud badge');
|
|
995
|
+
s.pop('Cloud badge', 10, { from: 30 });
|
|
996
|
+
s.finish();
|
|
997
|
+
return s;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
function laptop(s, state) {
|
|
1001
|
+
const connected = state !== 'none';
|
|
1002
|
+
const live = state === 'online';
|
|
1003
|
+
const screenY = DEVICE.y - 5;
|
|
1004
|
+
const baseY = screenY + SCREEN.h / 2 + 4;
|
|
1005
|
+
|
|
1006
|
+
s.shape('Screen', 'rounded', [WINDOW.w, WINDOW.h], [DEVICE.x, DEVICE.y], {
|
|
1007
|
+
fill: connected ? C.white : undefined,
|
|
1008
|
+
stroke: connected ? undefined : C.quiet,
|
|
1009
|
+
strokeWidth: connected ? undefined : 1.5,
|
|
1010
|
+
radius: 12,
|
|
1011
|
+
});
|
|
1012
|
+
for (let f = 0; f <= 44; f += 2) {
|
|
1013
|
+
const v = spring(f / FPS, 0.55, 0.8);
|
|
1014
|
+
s.key('Screen', RECT.size, f, [lerp(WINDOW.w, SCREEN.w, v), lerp(WINDOW.h, SCREEN.h, v)]);
|
|
1015
|
+
s.key('Screen', 'transform/position', f, [DEVICE.x, lerp(DEVICE.y, screenY, v), 0]);
|
|
1016
|
+
}
|
|
1017
|
+
if (connected) {
|
|
1018
|
+
s.key('Screen', FILL_COLOR, 0, C.white);
|
|
1019
|
+
s.key('Screen', FILL_COLOR, 20, C.ink);
|
|
1020
|
+
} else {
|
|
1021
|
+
s.run('shape.dashes.add', { layer: 'Screen' });
|
|
1022
|
+
s.set('Screen', DASHES.dash, 5);
|
|
1023
|
+
s.set('Screen', DASHES.gap, 4);
|
|
1024
|
+
for (let f = 0; f <= TOTAL; f += 8) s.key('Screen', DASHES.offset, f, -(f / LOOP_FRAMES) * 18);
|
|
1025
|
+
}
|
|
1026
|
+
s.shape('Base', 'rounded', [172, 9], [DEVICE.x, baseY], { fill: connected ? C.ink : C.quiet, radius: 4.5 });
|
|
1027
|
+
s.pop('Base', 10, { from: 70, damping: 0.8 });
|
|
1028
|
+
return { screenY, connected, live };
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
function mineScene(state) {
|
|
1032
|
+
const s = new Scene(`mine-${state}`);
|
|
1033
|
+
const live = state === 'online';
|
|
1034
|
+
phone(s, live ? { received: 198 } : {});
|
|
1035
|
+
linkDots(s, live ? C.orange : C.quiet, live ? 28 : 90);
|
|
1036
|
+
if (live) {
|
|
1037
|
+
comet(s, 'Comet out', { from: 0, to: 144 });
|
|
1038
|
+
comet(s, 'Comet back', { from: 144, to: TOTAL, reversed: true });
|
|
1039
|
+
}
|
|
1040
|
+
const { screenY } = laptop(s, state);
|
|
1041
|
+
|
|
1042
|
+
if (state === 'none') {
|
|
1043
|
+
s.shape('Plus badge', 'ellipse', [32, 32], [DEVICE.x, screenY - 8], { fill: C.orangeSoft });
|
|
1044
|
+
s.shape('Plus', 'rounded', [14, 2.2], [DEVICE.x, screenY - 8], { fill: C.orange, radius: 1.1 });
|
|
1045
|
+
s.run('shape.newShape', {
|
|
1046
|
+
layer: 'Plus',
|
|
1047
|
+
kind: 'rounded',
|
|
1048
|
+
size: [2.2, 14],
|
|
1049
|
+
position: [0, 0],
|
|
1050
|
+
space: 'layer',
|
|
1051
|
+
fill: C.orange,
|
|
1052
|
+
strokeType: 'none',
|
|
1053
|
+
});
|
|
1054
|
+
s.set('Plus', RECT.roundness, 1.1);
|
|
1055
|
+
s.parent(['Plus'], 'Plus badge');
|
|
1056
|
+
s.pop('Plus badge', 30, { from: 40 });
|
|
1057
|
+
for (let f = 74; f <= TOTAL; f += 6) {
|
|
1058
|
+
const v = 100 + 7 * ((1 - Math.cos(((f - 72) / LOOP_FRAMES) * 2 * Math.PI)) / 2);
|
|
1059
|
+
s.key('Plus badge', 'transform/scale', f, [v, v, 100]);
|
|
1060
|
+
}
|
|
1061
|
+
s.text('Not connected', 'Not connected', [DEVICE.x, screenY + 24], 10.5, C.muted, {
|
|
1062
|
+
justify: 'center',
|
|
1063
|
+
style: 'Medium',
|
|
1064
|
+
});
|
|
1065
|
+
s.fade('Not connected', 0, 100, 40, 52);
|
|
1066
|
+
s.finish();
|
|
1067
|
+
return s;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
const left = DEVICE.x - SCREEN.w / 2;
|
|
1071
|
+
const top = screenY - SCREEN.h / 2;
|
|
1072
|
+
const row = (name, y, width, tint, on, frame) => {
|
|
1073
|
+
const icon = `${name} icon`;
|
|
1074
|
+
const line = `${name} line`;
|
|
1075
|
+
s.shape(icon, 'rounded', [11, 9], [left + 18, top + y], { fill: tint, radius: 2 });
|
|
1076
|
+
s.shape(line, 'rounded', [width, 5], [left + 31 + width / 2, top + y], {
|
|
1077
|
+
fill: on ? '#E9E7E5' : '#5C5A58',
|
|
1078
|
+
radius: 2.5,
|
|
1079
|
+
});
|
|
1080
|
+
s.parent([line], icon);
|
|
1081
|
+
s.pop(icon, frame, { from: 70 });
|
|
1082
|
+
};
|
|
1083
|
+
if (live) {
|
|
1084
|
+
s.shape('File highlight', 'rounded', [132, 16], [DEVICE.x, top + 36], { fill: C.orange, radius: 5 });
|
|
1085
|
+
s.set('File highlight', 'transform/anchor', [-66, 0, 0]);
|
|
1086
|
+
s.set('File highlight', 'transform/position', [DEVICE.x - 66, top + 36, 0]);
|
|
1087
|
+
for (let f = 0; f <= 44; f += 2) {
|
|
1088
|
+
const v = spring(f / FPS);
|
|
1089
|
+
s.key('File highlight', 'transform/scale', 66 + f, [Math.max(0, v) * 100, 100, 100]);
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
row('Folder 1', 17, 58, C.peach, false, 24);
|
|
1093
|
+
row('File', 36, 76, C.white, true, 34);
|
|
1094
|
+
row('Folder 2', 55, 44, C.peach, false, 44);
|
|
1095
|
+
|
|
1096
|
+
const statusY = top + SCREEN.h - 13;
|
|
1097
|
+
const dotX = left + SCREEN.w - 46;
|
|
1098
|
+
s.shape('Status dot', 'ellipse', [6, 6], [dotX, statusY], { fill: live ? C.online : C.quiet });
|
|
1099
|
+
s.text('Status', live ? 'Online' : 'Offline', [dotX + 7, statusY + 3.4], 9.5, C.quiet, { style: 'Medium' });
|
|
1100
|
+
s.fade('Status', 0, 100, 54, 66);
|
|
1101
|
+
s.pop('Status dot', 54, { from: 40 });
|
|
1102
|
+
if (live) {
|
|
1103
|
+
s.shape('Status pulse', 'ellipse', [6, 6], [dotX, statusY], { stroke: C.online, strokeWidth: 1 });
|
|
1104
|
+
for (let f = 72; f <= TOTAL; f += 4) {
|
|
1105
|
+
const u = ((f - 72) % LOOP_FRAMES) / LOOP_FRAMES;
|
|
1106
|
+
const v = 100 + 180 * u;
|
|
1107
|
+
s.key('Status pulse', 'transform/scale', f, [v, v, 100]);
|
|
1108
|
+
s.key('Status pulse', 'transform/opacity', f, 100 * (1 - u));
|
|
1109
|
+
}
|
|
1110
|
+
s.key('Status pulse', 'transform/opacity', 71, 0);
|
|
1111
|
+
|
|
1112
|
+
const cx = 76;
|
|
1113
|
+
s.shape('Chip', 'rounded', [cx, 22], [DEVICE.x - 34, DEVICE.y - 12], {
|
|
1114
|
+
fill: C.white,
|
|
1115
|
+
stroke: C.line,
|
|
1116
|
+
strokeWidth: 1,
|
|
1117
|
+
radius: 11,
|
|
1118
|
+
});
|
|
1119
|
+
s.shape('Chip icon', 'rounded', [8, 10], [DEVICE.x - 34 - 27, DEVICE.y - 12], {
|
|
1120
|
+
fill: C.orangeText,
|
|
1121
|
+
radius: 2,
|
|
1122
|
+
});
|
|
1123
|
+
s.text('Chip name', 'Invoice.pdf', [DEVICE.x - 34 - 20, DEVICE.y - 12 + 3.6], 10, C.ink, { style: 'Medium' });
|
|
1124
|
+
s.parent(['Chip icon', 'Chip name'], 'Chip');
|
|
1125
|
+
const from = [DEVICE.x - 34, DEVICE.y - 12];
|
|
1126
|
+
const to = [PHONE.x + 4, PHONE.y + 12];
|
|
1127
|
+
const control = [(from[0] + to[0]) / 2, H / 2 - 44];
|
|
1128
|
+
for (let f = 118; f <= 200; f += 2) {
|
|
1129
|
+
const point = bezier(from, control, to, smooth((f - 126) / 70));
|
|
1130
|
+
s.key('Chip', 'transform/position', f, [point[0], point[1], 0]);
|
|
1131
|
+
}
|
|
1132
|
+
s.key('Chip', 'transform/opacity', 117, 0);
|
|
1133
|
+
s.key('Chip', 'transform/opacity', 124, 100);
|
|
1134
|
+
s.key('Chip', 'transform/opacity', 190, 100);
|
|
1135
|
+
s.key('Chip', 'transform/opacity', 200, 0);
|
|
1136
|
+
}
|
|
1137
|
+
s.finish();
|
|
1138
|
+
return s;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/** The exporter writes six decimals; a phone screen does not need them. */
|
|
1142
|
+
function compact(value) {
|
|
1143
|
+
if (Array.isArray(value)) return value.map(compact);
|
|
1144
|
+
if (value && typeof value === 'object')
|
|
1145
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, compact(v)]));
|
|
1146
|
+
if (typeof value === 'number') return Math.round(value * 1000) / 1000;
|
|
1147
|
+
return value;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Puts `ty` first in every object. Lottie on Android reads a shape by skipping ahead to its `ty` and drops every key
|
|
1152
|
+
* it passed on the way, so the engine's alphabetical keys (`ty` last) left every path, fill and stroke empty and the
|
|
1153
|
+
* animation drew nothing. iOS reads keys in any order, so it showed fine there.
|
|
1154
|
+
*/
|
|
1155
|
+
function tyFirst(value) {
|
|
1156
|
+
if (Array.isArray(value)) return value.map(tyFirst);
|
|
1157
|
+
if (value === null || typeof value !== 'object') return value;
|
|
1158
|
+
const out = 'ty' in value ? { ty: value.ty } : {};
|
|
1159
|
+
for (const [key, child] of Object.entries(value)) if (key !== 'ty') out[key] = tyFirst(child);
|
|
1160
|
+
return out;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
function build(scene) {
|
|
1164
|
+
const work = join(tmpdir(), `where-lucy-works-${process.pid}`);
|
|
1165
|
+
mkdirSync(work, { recursive: true });
|
|
1166
|
+
const motion = join(HERE, `${scene.name}.motion`);
|
|
1167
|
+
const lottie = join(work, `${scene.name}.json`);
|
|
1168
|
+
const request = {
|
|
1169
|
+
new: { template: 'blank' },
|
|
1170
|
+
commands: scene.commands,
|
|
1171
|
+
save: { path: join(work, `${scene.name}.motion`), ifExists: 'replace' },
|
|
1172
|
+
exportLottie: { path: lottie, textAsShapes: true, ifExists: 'replace' },
|
|
1173
|
+
...(process.env.WLW_PREVIEW
|
|
1174
|
+
? {
|
|
1175
|
+
render: {
|
|
1176
|
+
path: join(process.env.WLW_PREVIEW, `${scene.name}.mp4`),
|
|
1177
|
+
format: 'mp4',
|
|
1178
|
+
fps: 30,
|
|
1179
|
+
ifExists: 'replace',
|
|
1180
|
+
},
|
|
1181
|
+
}
|
|
1182
|
+
: {}),
|
|
1183
|
+
};
|
|
1184
|
+
const out = execFileSync(BIN, ['exec'], { input: JSON.stringify(request), encoding: 'utf8', maxBuffer: 1 << 28 });
|
|
1185
|
+
const result = JSON.parse(out.trim().split('\n').pop());
|
|
1186
|
+
if (!result.ok) throw new Error(`${scene.name}: ${result.error}`);
|
|
1187
|
+
writeFileSync(motion, readFileSync(join(work, `${scene.name}.motion`)));
|
|
1188
|
+
const data = tyFirst(compact(JSON.parse(readFileSync(lottie, 'utf8'))));
|
|
1189
|
+
data.nm = scene.asset;
|
|
1190
|
+
mkdirSync(ASSETS, { recursive: true });
|
|
1191
|
+
const target = join(ASSETS, `${scene.asset}.json`);
|
|
1192
|
+
writeFileSync(target, JSON.stringify(data));
|
|
1193
|
+
rmSync(work, { recursive: true, force: true });
|
|
1194
|
+
const warnings = result.lottie?.warnings ?? [];
|
|
1195
|
+
console.log(
|
|
1196
|
+
`${scene.name}: ${scene.commands.length} commands, ${(JSON.stringify(data).length / 1024).toFixed(0)} KB${warnings.length ? ` (${warnings.length} warnings: ${warnings[0]})` : ''}`,
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
const scenes = [
|
|
1201
|
+
...Object.keys(LOGO_ICONS).map(logoScene),
|
|
1202
|
+
chatScene(),
|
|
1203
|
+
cloudScene(),
|
|
1204
|
+
mineScene('none'),
|
|
1205
|
+
mineScene('online'),
|
|
1206
|
+
mineScene('offline'),
|
|
1207
|
+
];
|
|
1208
|
+
const only = process.argv[2];
|
|
1209
|
+
for (const scene of scenes) if (!only || scene.name === only) build(scene);
|