@auscera/cleoedits 0.0.0-stage → 0.1.0
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/README.md +62 -2
- package/cli.mjs +149 -0
- package/lib/dependencies.mjs +384 -0
- package/lib/run.mjs +114 -0
- package/lib/workspace.mjs +167 -0
- package/package.json +240 -3
- package/workspace/.agents/skills/cleoedits/SKILL.md +29 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/audiogram.json +41 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/facebook.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/linkedin.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/podcast.json +23 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/reels.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/shorts.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/tiktok.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/x.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/youtube-shorts.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/ffmpeg_templates/youtube.json +48 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/assets/LICENSE-SimpleIcons +30 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/assets/logos.json +1 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Anton-Regular.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/ArchivoBlack-Regular.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/InstrumentSerif-Italic.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Inter.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/LICENSE-PermanentMarker.txt +202 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Montserrat.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Anton.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-ArchivoBlack.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-InstrumentSerif.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Inter.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Montserrat.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-PlayfairDisplay.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-Poppins.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/OFL-SpaceMono.txt +93 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PermanentMarker-Regular.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PlayfairDisplay-Italic.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/PlayfairDisplay.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-Black.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-Bold.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/Poppins-ExtraBold.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/fonts/SpaceMono-Bold.ttf +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/LICENSE-MediaPipe +218 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/LICENSE-YuNet +21 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/NOTICE.md +4 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/selfie_segmenter.tflite +0 -0
- package/workspace/.agents/skills/cleoedits/assets/reel_effects/models/yunet.onnx +0 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/LICENSE +21 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/audio-app-ui/STYLE.md +65 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/STYLE.md +53 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/index.html +328 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/blueprint/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/data-story/STYLE.md +65 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/data-story/index.html +575 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/design-app-ui/STYLE.md +68 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/editor-ui/STYLE.md +73 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/STYLE.md +54 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/index.html +189 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/editorial-paper/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/explainer-diagram/STYLE.md +64 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/explainer-diagram/index.html +620 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/STYLE.md +55 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/index.html +238 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/graphite-ui/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/growing-city/STYLE.md +66 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/growing-city/index.html +602 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/ink-line/STYLE.md +66 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/ink-line/index.html +777 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/STYLE.md +56 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/index.html +186 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/midnight-grid/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/motion-app-ui/STYLE.md +68 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/STYLE.md +56 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/index.html +244 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-cut/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-world/STYLE.md +67 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/paper-world/index.html +663 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/particle-field/STYLE.md +59 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/particle-field/index.html +395 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/STYLE.md +52 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/index.html +194 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/poster-pop/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/STYLE.md +58 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/index.html +242 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/risograph/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/STYLE.md +53 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/index.html +138 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-grid/studio.js +57 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-kinetic/STYLE.md +63 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/swiss-kinetic/index.html +599 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/time-travel/STYLE.md +65 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/time-travel/index.html +1297 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/weather-widget/STYLE.md +69 -0
- package/workspace/.agents/skills/cleoedits/assets/video_styles/weather-widget/index.html +674 -0
- package/workspace/.agents/skills/cleoedits/references/audio-clearervoice-elevenlabs.md +11 -0
- package/workspace/.agents/skills/cleoedits/references/ffmpeg-and-reels.md +15 -0
- package/workspace/.agents/skills/cleoedits/references/hyperframes-workflows.md +13 -0
- package/workspace/.agents/skills/cleoedits/references/kdenlive-cli-and-mcp.md +12 -0
- package/workspace/.agents/skills/cleoedits/references/motion-design-pipeline.md +7 -0
- package/workspace/.agents/skills/cleoedits/references/motion-taste-emil.md +5 -0
- package/workspace/.agents/skills/cleoedits/references/playwright-demo-capture.md +9 -0
- package/workspace/.agents/skills/cleoedits/references/remotion-workflows.md +13 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/LICENSE +21 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_ass_overlay.py +399 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/__init__.py +235 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/alpha.py +560 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/asr.py +1237 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/color.py +540 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/decision.py +2452 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/drawtext.py +290 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/emit.py +1309 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/emoji.py +518 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/fonts.py +875 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/pacing.py +263 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/pacing_edit.py +432 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/probe.py +1613 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/runner.py +3994 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/text.py +73 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/timeline.py +721 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_common/wrap.py +981 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_contract.py +2454 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_platforms.py +258 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_review.html +754 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_review.py +258 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/_smartcut.py +450 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/audio.py +867 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/background.py +136 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/batch.py +1409 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/broll.py +282 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/caption.py +2207 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/check.py +815 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/color.py +695 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/crop.py +91 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/cropdetect.py +214 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/cut.py +2076 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/deinterlace.py +90 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/denoise.py +94 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/export.py +1033 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/fit.py +729 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/freeze.py +197 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/graphics.py +920 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/grid.py +235 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/insert.py +142 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/join.py +1083 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/look.py +475 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/loop.py +395 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/loudness.py +397 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/metadata.py +416 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/multicam.py +414 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/overlay.py +766 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/pad.py +121 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/probe.py +145 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/proxy.py +93 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/redact.py +162 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/render.py +2424 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/report.py +354 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/reverse.py +114 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/scenes.py +439 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sequence.py +285 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/silence.py +945 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/speedramp.py +193 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sphere.py +137 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/stabilize.py +141 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/straighten.py +120 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/sync.py +500 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/verify.py +411 -0
- package/workspace/.agents/skills/cleoedits/scripts/ffmpeg/waveform.py +502 -0
- package/workspace/.agents/skills/cleoedits/scripts/kdenlive_builder.py +284 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/LICENSE-claude-motion +21 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/LICENSE-motion-design +21 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/_media.py +43 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/pacing_check.py +90 -0
- package/workspace/.agents/skills/cleoedits/scripts/motion/storyboard.py +77 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/LICENSE +26 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/fx.py +2717 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/logos.py +194 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/sfx.py +105 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/trim.py +99 -0
- package/workspace/.agents/skills/cleoedits/scripts/reel_effects/words.py +60 -0
- package/workspace/.claude/commands/blender-3d.md +12 -0
- package/workspace/.claude/commands/business-short-form-reels.md +12 -0
- package/workspace/.claude/commands/color-grade.md +12 -0
- package/workspace/.claude/commands/cutout-grid-reel.md +12 -0
- package/workspace/.claude/commands/depth-ui-reel.md +12 -0
- package/workspace/.claude/commands/explainer-panel-reel.md +12 -0
- package/workspace/.claude/commands/freeze-frame.md +12 -0
- package/workspace/.claude/commands/glass-graph.md +12 -0
- package/workspace/.claude/commands/over-the-shoulder.md +12 -0
- package/workspace/.claude/commands/personal-short-form-reels.md +12 -0
- package/workspace/.claude/commands/ranking-format.md +12 -0
- package/workspace/.claude/commands/relight.md +12 -0
- package/workspace/.claude/commands/reverse-engineer.md +12 -0
- package/workspace/.claude/commands/text-behind.md +12 -0
- package/workspace/.claude/commands/tier-list.md +12 -0
- package/workspace/.claude-plugin/plugin.json +8 -0
- package/workspace/.npmignore +15 -0
- package/workspace/AGENTS.md +30 -0
- package/workspace/README.md +63 -0
- package/workspace/assets/fonts/TikTokSans-OFL.txt +93 -0
- package/workspace/assets/fonts/TikTokSans-Variable.ttf +0 -0
- package/workspace/assets/luts/clean_warm.cube +4917 -0
- package/workspace/assets/luts/golden_hour.cube +4917 -0
- package/workspace/assets/luts/moody_dark.cube +4917 -0
- package/workspace/assets/luts/teal_orange.cube +4917 -0
- package/workspace/assets/sfx/NOTICE.txt +1 -0
- package/workspace/assets/sfx/click.wav +0 -0
- package/workspace/assets/sfx/pop.wav +0 -0
- package/workspace/assets/sfx/riser.wav +0 -0
- package/workspace/assets/sfx/whoosh.wav +0 -0
- package/workspace/generators/hyperframes/index.html +39 -0
- package/workspace/generators/hyperframes/package.json +15 -0
- package/workspace/generators/hyperframes/pnpm-lock.yaml +1181 -0
- package/workspace/generators/hyperframes/pnpm-workspace.yaml +10 -0
- package/workspace/generators/remotion/eslint.config.mjs +3 -0
- package/workspace/generators/remotion/package.json +36 -0
- package/workspace/generators/remotion/pnpm-lock.yaml +4179 -0
- package/workspace/generators/remotion/pnpm-workspace.yaml +10 -0
- package/workspace/generators/remotion/remotion.config.ts +13 -0
- package/workspace/generators/remotion/src/Root.tsx +52 -0
- package/workspace/generators/remotion/src/index.css +1 -0
- package/workspace/generators/remotion/src/index.ts +4 -0
- package/workspace/generators/remotion/tsconfig.json +15 -0
- package/workspace/pipeline/scripts/_codec.py +28 -0
- package/workspace/pipeline/scripts/ai_media_api.py +109 -0
- package/workspace/pipeline/scripts/blender_render.py +166 -0
- package/workspace/pipeline/scripts/composite.py +49 -0
- package/workspace/pipeline/scripts/melt.sh +68 -0
- package/workspace/pipeline/scripts/normalize_audio.py +39 -0
- package/workspace/pipeline/scripts/person_matte.py +216 -0
- package/workspace/pipeline/scripts/record_demo.py +69 -0
- package/workspace/pipeline/scripts/whisper_cut.py +98 -0
- package/workspace-manifest.json +908 -0
|
@@ -0,0 +1,674 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=1920, height=1080" />
|
|
6
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
7
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
8
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@200;600&display=swap" />
|
|
9
|
+
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
|
10
|
+
<style>
|
|
11
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
12
|
+
html, body { margin: 0; width: 1920px; height: 1080px; overflow: hidden; background: #8fc3f2; }
|
|
13
|
+
#root { position: relative; width: 1920px; height: 1080px; overflow: hidden; }
|
|
14
|
+
#cv { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }
|
|
15
|
+
#ui {
|
|
16
|
+
position: absolute; left: 0; top: 0; width: 100px; height: 100px;
|
|
17
|
+
font-family: "Inter", sans-serif;
|
|
18
|
+
color: #fff; pointer-events: none;
|
|
19
|
+
}
|
|
20
|
+
.lab {
|
|
21
|
+
position: absolute; left: 0; top: 0; white-space: nowrap;
|
|
22
|
+
font-size: 70px; font-weight: 600; letter-spacing: -0.012em; line-height: 1;
|
|
23
|
+
text-shadow: 0 2px 24px rgba(0, 20, 50, 0.16);
|
|
24
|
+
opacity: 0; will-change: transform, opacity, filter;
|
|
25
|
+
}
|
|
26
|
+
#temp {
|
|
27
|
+
position: absolute; left: 0; bottom: 0; white-space: nowrap;
|
|
28
|
+
font-size: 300px; font-weight: 200; letter-spacing: -0.045em; line-height: 0.84;
|
|
29
|
+
font-variant-numeric: tabular-nums; text-shadow: 0 4px 40px rgba(0, 20, 50, 0.14);
|
|
30
|
+
will-change: transform, opacity;
|
|
31
|
+
}
|
|
32
|
+
#temp .deg { font-weight: 200; letter-spacing: 0; }
|
|
33
|
+
</style>
|
|
34
|
+
</head>
|
|
35
|
+
<body>
|
|
36
|
+
<div id="root" data-composition-id="main" data-start="0" data-duration="12" data-width="1920" data-height="1080">
|
|
37
|
+
<canvas id="cv" width="1920" height="1080" class="clip" data-start="0" data-duration="12" data-track-index="0"></canvas>
|
|
38
|
+
<div id="ui" class="clip" data-start="0" data-duration="12" data-track-index="1">
|
|
39
|
+
<div class="lab" id="w0"></div>
|
|
40
|
+
<div class="lab" id="w1"></div>
|
|
41
|
+
<div class="lab" id="w2"></div>
|
|
42
|
+
<div class="lab" id="w3"></div>
|
|
43
|
+
<div class="lab" id="w4"></div>
|
|
44
|
+
<div class="lab" id="w5"></div>
|
|
45
|
+
<div id="temp"><span id="tnum"></span><span class="deg" id="tunit"></span></div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<script>
|
|
49
|
+
/*
|
|
50
|
+
* One widget, every sky. 12 s, 1920x1080, one canvas + DOM text, drawn as a pure function of time.
|
|
51
|
+
* One weather widget lives through a whole day and never cuts away; it spring-morphs shape on every state change.
|
|
52
|
+
* Beat map (120 BPM):
|
|
53
|
+
* 0.0 to 2.0 widget lands (expo.out), sun rises inside it, label 1, numeral counts up
|
|
54
|
+
* 2.5 square springs to a wide pill, clouds roll in, label 2
|
|
55
|
+
* 4.5 / 6.5 pill springs to a tall card, rain (label 3); lightning flash + widget jolt (label 4)
|
|
56
|
+
* 7.5 to 10.0 card springs to a wide pill, navy night, moon, stars, shooting star at 9.3 (label 5)
|
|
57
|
+
* 10.0 to 12 pill springs back to the rounded square, dawn, sun rises again (label 6), hold
|
|
58
|
+
* Words and numbers: LABELS, TEMPS, UNIT below (SAMPLE DATA). Colours: SUN (the one warm accent) and the six
|
|
59
|
+
* sky palettes PM / PC / PR / PS / PN / PD under "palettes" (sky top, sky bottom, widget top, widget bottom, shadow).
|
|
60
|
+
*/
|
|
61
|
+
(function () {
|
|
62
|
+
// SAMPLE DATA: change these
|
|
63
|
+
const LABELS = ['Sunny', 'Cloudy', 'Rain', 'Storm', 'Clear night', 'Sunrise']; // one per state, max 3 words each
|
|
64
|
+
const TEMPS = [12, 18, 15, 11, 9, 6, 12]; // start value, then the value each state counts to
|
|
65
|
+
const UNIT = '\u00B0'; // degree sign
|
|
66
|
+
const W = 1920, H = 1080, DUR = 12;
|
|
67
|
+
const cv = document.getElementById('cv');
|
|
68
|
+
const ctx = cv.getContext('2d');
|
|
69
|
+
const ui = document.getElementById('ui');
|
|
70
|
+
const tempEl = document.getElementById('temp');
|
|
71
|
+
const tnum = document.getElementById('tnum');
|
|
72
|
+
const labs = [0, 1, 2, 3, 4, 5].map(i => document.getElementById('w' + i));
|
|
73
|
+
labs.forEach((el, i) => { el.textContent = LABELS[i]; });
|
|
74
|
+
document.getElementById('tunit').textContent = UNIT;
|
|
75
|
+
tnum.textContent = String(TEMPS[0]);
|
|
76
|
+
|
|
77
|
+
// ---------- helpers ----------
|
|
78
|
+
const E = n => gsap.parseEase(n);
|
|
79
|
+
const eOut3 = E('power3.out'), eExpo = E('expo.out'), eIO = E('power2.inOut'), eIn = E('power2.in'),
|
|
80
|
+
eSine = E('sine.inOut'), eIO3 = E('power3.inOut');
|
|
81
|
+
const cl = (x, a = 0, b = 1) => Math.min(b, Math.max(a, x));
|
|
82
|
+
const pr = (t, a, b) => cl((t - a) / (b - a));
|
|
83
|
+
const lerp = (a, b, k) => a + (b - a) * k;
|
|
84
|
+
const mix = (a, b, k) => a.map((v, i) => v + (b[i] - v) * k);
|
|
85
|
+
const rgb = (c, a = 1) => `rgba(${c[0] | 0},${c[1] | 0},${c[2] | 0},${a})`;
|
|
86
|
+
const hex = h => [1, 3, 5].map(i => parseInt(h.slice(i, i + 2), 16));
|
|
87
|
+
function mulberry(a) { return function () { a |= 0; a = a + 0x6D2B79F5 | 0; let t = Math.imul(a ^ a >>> 15, 1 | a); t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t; return ((t ^ t >>> 14) >>> 0) / 4294967296; }; }
|
|
88
|
+
const R = mulberry(20261020);
|
|
89
|
+
// underdamped spring from rest, ~7% overshoot
|
|
90
|
+
const spring = p => { if (p <= 0) return 0; if (p >= 1) return 1; const z = 6.5, wd = 8.2; return 1 - Math.exp(-z * p) * (Math.cos(wd * p) + (z / wd) * Math.sin(wd * p)); };
|
|
91
|
+
const SUN = [255, 201, 74];
|
|
92
|
+
|
|
93
|
+
// ---------- palettes ----------
|
|
94
|
+
const P = (st, sb, wt, wb, sh) => ({ st: hex(st), sb: hex(sb), wt: hex(wt), wb: hex(wb), sh });
|
|
95
|
+
const PM = P('#86BDF0', '#E8F3FC', '#2A78E2', '#73B8F7', [24, 78, 150, 0.34]);
|
|
96
|
+
const PC = P('#8799AE', '#CED7E1', '#566D86', '#8A9EB3', [40, 56, 76, 0.36]);
|
|
97
|
+
const PR = P('#334254', '#5B6B7F', '#1D2939', '#3A4A5F', [6, 10, 18, 0.5]);
|
|
98
|
+
const PS = P('#222D3B', '#3E4B5D', '#121A25', '#2A3748', [4, 8, 14, 0.58]);
|
|
99
|
+
const PN = P('#0E1A33', '#1E3263', '#1A2D5A', '#0B1530', [2, 5, 14, 0.62]);
|
|
100
|
+
const PD = P('#3A5FA6', '#F7E6BC', '#3468C2', '#C9DCF2', [30, 62, 120, 0.34]);
|
|
101
|
+
const palSteps = [[2.35, 3.55, PC], [4.35, 5.35, PR], [5.6, 6.45, PS], [7.35, 8.6, PN], [9.9, 11.1, PD]];
|
|
102
|
+
function palette(t) {
|
|
103
|
+
let p = PM;
|
|
104
|
+
for (const [a, b, q] of palSteps) {
|
|
105
|
+
const k = eIO(pr(t, a, b));
|
|
106
|
+
if (k <= 0) break;
|
|
107
|
+
p = { st: mix(p.st, q.st, k), sb: mix(p.sb, q.sb, k), wt: mix(p.wt, q.wt, k), wb: mix(p.wb, q.wb, k), sh: mix(p.sh, q.sh, k) };
|
|
108
|
+
}
|
|
109
|
+
return p;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ---------- widget shape ----------
|
|
113
|
+
const SQ = { w: 880, h: 880, r: 140 }, PL = { w: 1680, h: 620, r: 310 }, TC = { w: 720, h: 940, r: 96 }, NP = { w: 1720, h: 600, r: 300 };
|
|
114
|
+
const morphs = [[2.5, PL], [4.5, TC], [7.5, NP], [10.0, SQ]];
|
|
115
|
+
const MD = 1.25;
|
|
116
|
+
function box(t) {
|
|
117
|
+
let b = { ...SQ };
|
|
118
|
+
for (const [t0, q] of morphs) {
|
|
119
|
+
const kw = spring((t - t0) / MD), kh = spring((t - t0 - 0.06) / MD), kr = spring((t - t0 - 0.03) / MD);
|
|
120
|
+
b = { w: lerp(b.w, q.w, kw), h: lerp(b.h, q.h, kh), r: lerp(b.r, q.r, kr) };
|
|
121
|
+
}
|
|
122
|
+
const ent = eExpo(pr(t, 0, 1.1));
|
|
123
|
+
const s = 0.9 + 0.1 * ent;
|
|
124
|
+
let cx = W / 2, cy = H / 2 + 60 * (1 - ent) + Math.sin(t * 1.3) * 4 * ent;
|
|
125
|
+
// lightning jolt
|
|
126
|
+
if (t > 6.5) { const a = t - 6.5; cx += 9 * Math.exp(-a * 9) * Math.sin(a * 70); cy += 5 * Math.exp(-a * 9) * Math.sin(a * 55 + 1); }
|
|
127
|
+
const w = b.w * s, h = b.h * s, r = Math.min(b.r * s, w / 2, h / 2);
|
|
128
|
+
return { x0: cx - w / 2, y0: cy - h / 2, x1: cx + w / 2, y1: cy + h / 2, w, h, r, cx, cy, alpha: eOut3(pr(t, 0, 0.45)), base: b };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ---------- seeded scene data ----------
|
|
132
|
+
const bgBlobs = Array.from({ length: 11 }, () => ({ x: R() * 2600 - 300, y: 80 + R() * 920, r: 260 + R() * 360, sp: 14 + R() * 26, k: R() }));
|
|
133
|
+
const puffBase = [[-0.95, 0.12, 0.46], [-0.42, -0.12, 0.62], [0.18, -0.34, 0.78], [0.82, -0.06, 0.6], [1.22, 0.16, 0.42]];
|
|
134
|
+
const clouds = [
|
|
135
|
+
{ u: 0.86, v: 0.17, s: 0.7, d: 0.35, delay: 0.0, far: 1 },
|
|
136
|
+
{ u: 0.50, v: 0.14, s: 0.62, d: 0.3, delay: 0.5, far: 1 },
|
|
137
|
+
{ u: 0.70, v: 0.30, s: 1.0, d: 0.6, delay: 0.2 },
|
|
138
|
+
{ u: 0.95, v: 0.40, s: 1.15, d: 0.85, delay: 0.1 },
|
|
139
|
+
{ u: 0.56, v: 0.44, s: 0.9, d: 0.75, delay: 0.75 },
|
|
140
|
+
{ u: 0.20, v: 0.30, s: 0.95, d: 0.7, delay: 2.4, storm: 1 },
|
|
141
|
+
{ u: 0.80, v: 0.50, s: 0.8, d: 0.5, delay: 1.6, low: 1 },
|
|
142
|
+
{ u: 0.36, v: 0.10, s: 0.85, d: 0.5, delay: 2.6, storm: 1 },
|
|
143
|
+
].map(c => ({ ...c, puffs: puffBase.map(p => [p[0] + (R() - 0.5) * 0.16, p[1] + (R() - 0.5) * 0.1, p[2] * (0.88 + R() * 0.24)]) }));
|
|
144
|
+
const wisps = Array.from({ length: 4 }, (_, i) => ({ u: [0.12, 0.42, 0.7, 0.28][i], v: [0.18, 0.1, 0.24, 0.32][i], l: 160 + R() * 160, sp: 10 + R() * 14 }));
|
|
145
|
+
const ridgeDef = [
|
|
146
|
+
{ base: 236, amp: 62, f: [1 / 760, 1 / 340, 1 / 150], ph: [R() * 6, R() * 6, R() * 6], drift: 4, tone: 0.1 },
|
|
147
|
+
{ base: 150, amp: 50, f: [1 / 620, 1 / 290, 1 / 130], ph: [R() * 6, R() * 6, R() * 6], drift: 9, tone: 0.4 },
|
|
148
|
+
{ base: 70, amp: 40, f: [1 / 540, 1 / 250, 1 / 110], ph: [R() * 6, R() * 6, R() * 6], drift: 16, tone: 0.75 },
|
|
149
|
+
];
|
|
150
|
+
const drops = Array.from({ length: 190 }, () => ({ a: R(), v: 1700 + R() * 900, len: 46 + R() * 70, off: R(), on: R(), w: 1.4 + R() * 1.4 }));
|
|
151
|
+
const bgDrops = Array.from({ length: 300 }, () => ({ x: R() * 2200 - 140, v: 2400 + R() * 1200, len: 70 + R() * 90, off: R(), on: R() }));
|
|
152
|
+
const beads = Array.from({ length: 46 }, () => ({ u: 0.04 + R() * 0.92, v: 0.05 + R() * 0.9, r: 3 + R() * 8, t: 4.9 + R() * 1.8, slide: R() < 0.18, sv: 30 + R() * 70 }));
|
|
153
|
+
const stars = Array.from({ length: 110 }, () => ({ u: R(), v: R() * 0.8, r: 0.7 + Math.pow(R(), 3) * 2.4, t: 8.0 + R() * 1.7, f: 1.5 + R() * 4, ph: R() * 6.28 }));
|
|
154
|
+
const bgStars = Array.from({ length: 240 }, () => ({ x: R() * W, y: R() * H * 0.95, r: 0.5 + Math.pow(R(), 4) * 1.8, t: 7.9 + R() * 1.6, f: 1 + R() * 3, ph: R() * 6.28 }));
|
|
155
|
+
const maria = Array.from({ length: 6 }, () => ({ x: (R() - 0.5) * 1.0, y: (R() - 0.5) * 1.0, r: 0.22 + R() * 0.3 }));
|
|
156
|
+
// lightning bolt (unit space: x across, y 0..1 down)
|
|
157
|
+
function bolt(seed) {
|
|
158
|
+
const r = mulberry(seed);
|
|
159
|
+
let pts = [[0, 0], [0.08, 1]];
|
|
160
|
+
let disp = 0.22;
|
|
161
|
+
for (let lvl = 0; lvl < 6; lvl++) {
|
|
162
|
+
const np = [pts[0]];
|
|
163
|
+
for (let i = 1; i < pts.length; i++) {
|
|
164
|
+
const a = pts[i - 1], b = pts[i];
|
|
165
|
+
np.push([(a[0] + b[0]) / 2 + (r() - 0.5) * disp, (a[1] + b[1]) / 2 + (r() - 0.5) * disp * 0.15]);
|
|
166
|
+
np.push(b);
|
|
167
|
+
}
|
|
168
|
+
pts = np; disp *= 0.55;
|
|
169
|
+
}
|
|
170
|
+
const branches = [];
|
|
171
|
+
for (let k = 0; k < 3; k++) {
|
|
172
|
+
const i0 = 12 + Math.floor(r() * 36), s = pts[i0], dir = r() < 0.5 ? -1 : 1;
|
|
173
|
+
const br = [s]; let x = s[0], y = s[1];
|
|
174
|
+
for (let j = 0; j < 9; j++) { x += dir * (0.02 + r() * 0.03); y += 0.02 + r() * 0.025; br.push([x + (r() - 0.5) * 0.02, y]); }
|
|
175
|
+
branches.push(br);
|
|
176
|
+
}
|
|
177
|
+
return { pts, branches };
|
|
178
|
+
}
|
|
179
|
+
const B1 = bolt(77), B2 = bolt(1312);
|
|
180
|
+
|
|
181
|
+
// film grain tile
|
|
182
|
+
const grain = document.createElement('canvas'); grain.width = grain.height = 256;
|
|
183
|
+
{ const g = grain.getContext('2d'), id = g.createImageData(256, 256), gr = mulberry(9);
|
|
184
|
+
for (let i = 0; i < id.data.length; i += 4) { const v = 128 + (gr() - 0.5) * 255; id.data[i] = id.data[i + 1] = id.data[i + 2] = v; id.data[i + 3] = 255; }
|
|
185
|
+
g.putImageData(id, 0, 0); }
|
|
186
|
+
const grainPat = ctx.createPattern(grain, 'repeat');
|
|
187
|
+
|
|
188
|
+
// ---------- timing curves ----------
|
|
189
|
+
const sunRise = t => eOut3(pr(t, 0.15, 1.9));
|
|
190
|
+
const dawnRise = t => eOut3(pr(t, 10.15, 12.2));
|
|
191
|
+
const cloudIn = t => pr(t, 1.9, 3.9);
|
|
192
|
+
const cloudOut = t => eIO(pr(t, 7.3, 8.3));
|
|
193
|
+
const rainW = t => eIO(pr(t, 4.55, 5.2)) * (1 - eIO(pr(t, 7.15, 7.9)));
|
|
194
|
+
const darkW = t => eIO(pr(t, 4.2, 5.2)) * (1 - 0.5 * eIO(pr(t, 7.4, 8.4)));
|
|
195
|
+
const nightW = t => eIO(pr(t, 7.6, 8.7)) * (1 - eIO(pr(t, 9.95, 10.9)));
|
|
196
|
+
function flash(t) {
|
|
197
|
+
let f = 0;
|
|
198
|
+
if (t >= 6.5) f += Math.exp(-(t - 6.5) * 16);
|
|
199
|
+
if (t >= 6.66) f += 0.75 * Math.exp(-(t - 6.66) * 18);
|
|
200
|
+
if (t >= 6.9) f += 0.25 * Math.exp(-(t - 6.9) * 22);
|
|
201
|
+
return Math.min(1, f);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ---------- drawing ----------
|
|
205
|
+
function sunPos(b, t) {
|
|
206
|
+
const ax = b.x1 - Math.min(240, b.w * 0.28), ay = b.y0 + Math.min(236, b.h * 0.37);
|
|
207
|
+
const morning = sunRise(t), dawn = dawnRise(t);
|
|
208
|
+
let y = ay + (1 - morning) * b.h * 0.95, vis = 1;
|
|
209
|
+
const dim = eIO(pr(t, 2.9, 4.9));
|
|
210
|
+
vis = 1 - dim;
|
|
211
|
+
if (t > 9.8) { y = ay + b.h * 0.14 + (1 - dawn) * b.h * 0.8; vis = pr(t, 10.1, 10.3); }
|
|
212
|
+
return { x: ax, y, vis, cover: dim };
|
|
213
|
+
}
|
|
214
|
+
function moonPos(b, t) {
|
|
215
|
+
const ax = b.x1 - Math.min(340, b.w * 0.22), ay = b.y0 + b.h * 0.33;
|
|
216
|
+
const k = eExpo(pr(t, 7.9, 9.4)), set = eIn(pr(t, 9.55, 10.3));
|
|
217
|
+
return { x: ax - set * 60, y: ay + (1 - k) * b.h * 0.9 + set * b.h * 0.9, vis: pr(t, 7.85, 8.1) * (1 - pr(t, 10.1, 10.3)) };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function drawSky(t, pal, b, sun, moon) {
|
|
221
|
+
const fl = flash(t);
|
|
222
|
+
const g = ctx.createLinearGradient(0, 0, 0, H);
|
|
223
|
+
g.addColorStop(0, rgb(pal.st)); g.addColorStop(1, rgb(pal.sb));
|
|
224
|
+
ctx.fillStyle = g; ctx.fillRect(0, 0, W, H);
|
|
225
|
+
// dawn horizon warmth
|
|
226
|
+
const dawnK = eIO(pr(t, 9.9, 11.2));
|
|
227
|
+
if (dawnK > 0) {
|
|
228
|
+
const hg = ctx.createRadialGradient(W * 0.62, H * 1.15, 0, W * 0.62, H * 1.15, 1300);
|
|
229
|
+
hg.addColorStop(0, `rgba(255,214,120,${0.5 * dawnK})`); hg.addColorStop(0.5, `rgba(255,226,170,${0.18 * dawnK})`); hg.addColorStop(1, 'rgba(255,230,180,0)');
|
|
230
|
+
ctx.fillStyle = hg; ctx.fillRect(0, 0, W, H);
|
|
231
|
+
}
|
|
232
|
+
// sun light spilling past the widget
|
|
233
|
+
const sl = sun.vis * (t < 9.8 ? sunRise(t) : dawnRise(t));
|
|
234
|
+
if (sl > 0.01) {
|
|
235
|
+
const r = 1100, sg = ctx.createRadialGradient(sun.x, sun.y, 0, sun.x, sun.y, r);
|
|
236
|
+
sg.addColorStop(0, `rgba(255,236,170,${0.55 * sl})`); sg.addColorStop(0.35, `rgba(255,240,200,${0.2 * sl})`); sg.addColorStop(1, 'rgba(255,240,200,0)');
|
|
237
|
+
ctx.fillStyle = sg; ctx.fillRect(0, 0, W, H);
|
|
238
|
+
}
|
|
239
|
+
if (moon.vis > 0.01) {
|
|
240
|
+
const mg = ctx.createRadialGradient(moon.x, moon.y, 0, moon.x, moon.y, 900);
|
|
241
|
+
mg.addColorStop(0, `rgba(150,175,235,${0.22 * moon.vis})`); mg.addColorStop(1, 'rgba(150,175,235,0)');
|
|
242
|
+
ctx.fillStyle = mg; ctx.fillRect(0, 0, W, H);
|
|
243
|
+
}
|
|
244
|
+
// background stars
|
|
245
|
+
const nw = nightW(t);
|
|
246
|
+
if (nw > 0.01) {
|
|
247
|
+
for (const s of bgStars) {
|
|
248
|
+
const a = eOut3(pr(t, s.t, s.t + 0.5)) * nw * (0.55 + 0.45 * Math.sin(t * s.f + s.ph));
|
|
249
|
+
if (a <= 0.01) continue;
|
|
250
|
+
ctx.fillStyle = `rgba(235,240,255,${a * 0.8})`;
|
|
251
|
+
ctx.beginPath(); ctx.arc(s.x, s.y, s.r, 0, 6.283); ctx.fill();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
// soft background clouds (out of focus)
|
|
255
|
+
const ci = eIO(cloudIn(t)), co = cloudOut(t), dk = darkW(t);
|
|
256
|
+
const morningWisp = 0.35 * (1 - ci) * (1 - nightW(t)) * (1 - pr(t, 9.5, 10)) + 0.35 * eIO(pr(t, 10.3, 11.5));
|
|
257
|
+
const cloudA = Math.max(morningWisp, ci * (1 - co) * 0.75);
|
|
258
|
+
if (cloudA > 0.01) {
|
|
259
|
+
for (const c of bgBlobs) {
|
|
260
|
+
let x = ((c.x - t * c.sp - co * 900) % 2600 + 2600) % 2600 - 300;
|
|
261
|
+
const col = mix([255, 255, 255], [52, 64, 80], dk);
|
|
262
|
+
const lit = mix(col, [235, 240, 255], fl * 0.6);
|
|
263
|
+
for (let k = 0; k < 3; k++) {
|
|
264
|
+
const ox = x + (k - 1) * c.r * 0.7, oy = c.y + (k === 1 ? -c.r * 0.18 : 0), rr = c.r * (k === 1 ? 1 : 0.75);
|
|
265
|
+
const g2 = ctx.createRadialGradient(ox, oy, 0, ox, oy, rr);
|
|
266
|
+
const a = cloudA * (0.30 + 0.25 * c.k) * (dk > 0 ? lerp(1, 1.5, dk) : 1);
|
|
267
|
+
g2.addColorStop(0, rgb(lit, Math.min(0.75, a))); g2.addColorStop(1, rgb(lit, 0));
|
|
268
|
+
ctx.fillStyle = g2; ctx.fillRect(ox - rr, oy - rr, rr * 2, rr * 2);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// distant rain
|
|
273
|
+
const rw = rainW(t);
|
|
274
|
+
if (rw > 0.01) {
|
|
275
|
+
ctx.lineCap = 'round'; ctx.lineWidth = 1.2; ctx.strokeStyle = `rgba(200,212,230,${0.22 * rw})`;
|
|
276
|
+
ctx.beginPath();
|
|
277
|
+
for (const d of bgDrops) {
|
|
278
|
+
if (d.on > rw) continue;
|
|
279
|
+
const Hc = H + 300, s = ((t * d.v + d.off * Hc) % Hc), y = s - 200, x = d.x + y * 0.16;
|
|
280
|
+
ctx.moveTo(x - d.len * 0.16, y - d.len); ctx.lineTo(x, y);
|
|
281
|
+
}
|
|
282
|
+
ctx.stroke();
|
|
283
|
+
}
|
|
284
|
+
// distant bolt
|
|
285
|
+
if (t > 6.64 && t < 6.78) {
|
|
286
|
+
const k = 1 - pr(t, 6.64, 6.78);
|
|
287
|
+
drawBolt(B2, 230, -20, 520, 0.35 * k, 0.6);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function drawBolt(Bt, ox, oy, len, a, sc) {
|
|
292
|
+
ctx.save();
|
|
293
|
+
ctx.lineJoin = 'round'; ctx.lineCap = 'round';
|
|
294
|
+
const path = pts => { ctx.beginPath(); pts.forEach((p, i) => { const x = ox + p[0] * len, y = oy + p[1] * len; i ? ctx.lineTo(x, y) : ctx.moveTo(x, y); }); };
|
|
295
|
+
ctx.shadowColor = `rgba(190,215,255,${a})`; ctx.shadowBlur = 40 * sc;
|
|
296
|
+
ctx.strokeStyle = `rgba(190,210,255,${0.35 * a})`; ctx.lineWidth = 16 * sc; path(Bt.pts); ctx.stroke();
|
|
297
|
+
ctx.shadowBlur = 16 * sc;
|
|
298
|
+
ctx.strokeStyle = `rgba(200,220,255,${0.6 * a})`; ctx.lineWidth = 7 * sc; path(Bt.pts); ctx.stroke();
|
|
299
|
+
ctx.strokeStyle = `rgba(255,255,255,${a})`; ctx.lineWidth = 3.2 * sc; path(Bt.pts); ctx.stroke();
|
|
300
|
+
ctx.lineWidth = 1.8 * sc; for (const br of Bt.branches) { path(br); ctx.stroke(); }
|
|
301
|
+
ctx.restore();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function rr(x, y, w, h, r) { ctx.beginPath(); ctx.roundRect(x, y, w, h, r); }
|
|
305
|
+
|
|
306
|
+
function cloudPath(x, y, size, ps, grow = 0) {
|
|
307
|
+
ctx.beginPath();
|
|
308
|
+
for (const p of ps) { const r = p[2] * size + grow; ctx.moveTo(x + p[0] * size + r, y + p[1] * size); ctx.arc(x + p[0] * size, y + p[1] * size, r, 0, 6.283); }
|
|
309
|
+
ctx.roundRect(x - 1.25 * size - grow, y + 0.02 * size - grow, 2.6 * size + grow * 2, 0.56 * size + grow * 2, 0.28 * size + grow);
|
|
310
|
+
}
|
|
311
|
+
function drawCloud(x, y, size, light, shade, alpha, shadowA) {
|
|
312
|
+
const ps = this_puffs;
|
|
313
|
+
ctx.save();
|
|
314
|
+
ctx.globalAlpha *= alpha;
|
|
315
|
+
// soft cast shadow
|
|
316
|
+
ctx.shadowColor = `rgba(8,20,45,${shadowA})`; ctx.shadowBlur = size * 0.6; ctx.shadowOffsetY = size * 0.3;
|
|
317
|
+
cloudPath(x, y, size, ps);
|
|
318
|
+
const g = ctx.createLinearGradient(0, y - size * 1.1, 0, y + size * 0.6);
|
|
319
|
+
g.addColorStop(0, rgb(light)); g.addColorStop(0.55, rgb(mix(light, shade, 0.45))); g.addColorStop(1, rgb(shade));
|
|
320
|
+
ctx.fillStyle = g; ctx.fill();
|
|
321
|
+
ctx.shadowColor = 'transparent';
|
|
322
|
+
// inner volume: soft lit domes, no hard seams
|
|
323
|
+
ctx.save(); cloudPath(x, y, size, ps); ctx.clip();
|
|
324
|
+
for (const p of ps) {
|
|
325
|
+
const px = x + p[0] * size + p[2] * size * 0.18, py = y + p[1] * size - p[2] * size * 0.32, r = p[2] * size * 1.0;
|
|
326
|
+
const hg = ctx.createRadialGradient(px, py, 0, px, py, r);
|
|
327
|
+
hg.addColorStop(0, rgb(light, 0.75)); hg.addColorStop(1, rgb(light, 0));
|
|
328
|
+
ctx.fillStyle = hg; ctx.fillRect(px - r, py - r, r * 2, r * 2);
|
|
329
|
+
// underside occlusion of each puff
|
|
330
|
+
const oy = y + p[1] * size + p[2] * size * 0.75, orr = p[2] * size * 0.9;
|
|
331
|
+
const og = ctx.createRadialGradient(x + p[0] * size, oy, 0, x + p[0] * size, oy, orr);
|
|
332
|
+
og.addColorStop(0, rgb(shade, 0.35)); og.addColorStop(1, rgb(shade, 0));
|
|
333
|
+
ctx.fillStyle = og; ctx.fillRect(x + p[0] * size - orr, oy - orr, orr * 2, orr * 2);
|
|
334
|
+
}
|
|
335
|
+
ctx.restore();
|
|
336
|
+
ctx.restore();
|
|
337
|
+
}
|
|
338
|
+
let this_puffs = null;
|
|
339
|
+
|
|
340
|
+
function drawWidget(t, pal, b, sun, moon) {
|
|
341
|
+
const fl = flash(t);
|
|
342
|
+
ctx.save();
|
|
343
|
+
ctx.globalAlpha = b.alpha;
|
|
344
|
+
// shadows: wide ambient + tight contact
|
|
345
|
+
const sh = pal.sh;
|
|
346
|
+
ctx.save();
|
|
347
|
+
ctx.shadowColor = rgb(sh, sh[3]); ctx.shadowBlur = 140; ctx.shadowOffsetY = 60;
|
|
348
|
+
rr(b.x0, b.y0, b.w, b.h, b.r); ctx.fillStyle = rgb(pal.wb); ctx.fill();
|
|
349
|
+
ctx.shadowColor = rgb(sh, sh[3] * 0.6); ctx.shadowBlur = 34; ctx.shadowOffsetY = 14; ctx.fill();
|
|
350
|
+
ctx.restore();
|
|
351
|
+
// body
|
|
352
|
+
rr(b.x0, b.y0, b.w, b.h, b.r);
|
|
353
|
+
const g = ctx.createLinearGradient(0, b.y0, 0, b.y1);
|
|
354
|
+
g.addColorStop(0, rgb(pal.wt)); g.addColorStop(1, rgb(pal.wb));
|
|
355
|
+
ctx.fillStyle = g; ctx.fill();
|
|
356
|
+
ctx.save(); ctx.clip();
|
|
357
|
+
|
|
358
|
+
// sun (behind everything else in the widget sky)
|
|
359
|
+
const sunA = sun.vis;
|
|
360
|
+
if (sunA > 0.01) {
|
|
361
|
+
const pulse = 1 + 0.02 * Math.sin(t * 3.1);
|
|
362
|
+
const SR = 100 * pulse;
|
|
363
|
+
const warm = ctx.createRadialGradient(sun.x, sun.y, 0, sun.x, sun.y, 820);
|
|
364
|
+
warm.addColorStop(0, `rgba(255,214,110,${0.55 * sunA})`); warm.addColorStop(0.22, `rgba(255,222,140,${0.26 * sunA})`);
|
|
365
|
+
warm.addColorStop(0.55, `rgba(255,232,180,${0.08 * sunA})`); warm.addColorStop(1, 'rgba(255,232,180,0)');
|
|
366
|
+
ctx.fillStyle = warm; ctx.fillRect(b.x0, b.y0, b.w, b.h);
|
|
367
|
+
ctx.save(); ctx.globalAlpha *= sunA;
|
|
368
|
+
ctx.shadowColor = 'rgba(255,196,60,0.95)'; ctx.shadowBlur = 90;
|
|
369
|
+
const dg = ctx.createRadialGradient(sun.x - SR * 0.28, sun.y - SR * 0.3, SR * 0.05, sun.x, sun.y, SR);
|
|
370
|
+
dg.addColorStop(0, '#FFF6D2'); dg.addColorStop(0.45, '#FFDC72'); dg.addColorStop(1, '#FFC94A');
|
|
371
|
+
ctx.fillStyle = dg; ctx.beginPath(); ctx.arc(sun.x, sun.y, SR, 0, 6.283); ctx.fill();
|
|
372
|
+
ctx.restore();
|
|
373
|
+
// soft crepuscular beams
|
|
374
|
+
const lb = sunA * (t < 9.8 ? sunRise(t) : dawnRise(t)) * (t < 9.8 ? 1 - eIO(pr(t, 2.2, 3.0)) : 1.3);
|
|
375
|
+
if (lb > 0.01) {
|
|
376
|
+
ctx.save(); ctx.globalCompositeOperation = 'screen';
|
|
377
|
+
for (let k = 0; k < 6; k++) {
|
|
378
|
+
const ang = 1.95 + k * 0.2 + Math.sin(t * 0.4 + k * 1.7) * 0.03, len = 1100, wdt = 0.035 + (k % 3) * 0.018;
|
|
379
|
+
const bgr = ctx.createLinearGradient(sun.x, sun.y, sun.x + Math.cos(ang) * len, sun.y + Math.sin(ang) * len);
|
|
380
|
+
const ba = lb * (0.07 + 0.04 * Math.sin(t * 1.3 + k * 2.1));
|
|
381
|
+
bgr.addColorStop(0, `rgba(255,236,180,${ba})`); bgr.addColorStop(1, 'rgba(255,236,180,0)');
|
|
382
|
+
ctx.fillStyle = bgr; ctx.beginPath(); ctx.moveTo(sun.x, sun.y);
|
|
383
|
+
ctx.lineTo(sun.x + Math.cos(ang - wdt) * len, sun.y + Math.sin(ang - wdt) * len);
|
|
384
|
+
ctx.lineTo(sun.x + Math.cos(ang + wdt) * len, sun.y + Math.sin(ang + wdt) * len); ctx.closePath(); ctx.fill();
|
|
385
|
+
}
|
|
386
|
+
ctx.restore();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// stars + moon
|
|
391
|
+
const nw = nightW(t);
|
|
392
|
+
if (nw > 0.01) {
|
|
393
|
+
for (const s of stars) {
|
|
394
|
+
const ap = eOut3(pr(t, s.t, s.t + 0.45));
|
|
395
|
+
const a = ap * nw * (0.65 + 0.35 * Math.sin(t * s.f + s.ph));
|
|
396
|
+
if (a < 0.01) continue;
|
|
397
|
+
const x = b.x0 + s.u * b.w, y = b.y0 + s.v * b.h * 0.75, r = s.r * 1.25 * (0.7 + 0.3 * ap);
|
|
398
|
+
if (s.r > 1.6) {
|
|
399
|
+
const sg = ctx.createRadialGradient(x, y, 0, x, y, r * 7);
|
|
400
|
+
sg.addColorStop(0, `rgba(200,215,255,${0.35 * a})`); sg.addColorStop(1, 'rgba(200,215,255,0)');
|
|
401
|
+
ctx.fillStyle = sg; ctx.fillRect(x - r * 7, y - r * 7, r * 14, r * 14);
|
|
402
|
+
}
|
|
403
|
+
ctx.fillStyle = `rgba(245,248,255,${a})`;
|
|
404
|
+
ctx.beginPath(); ctx.arc(x, y, r, 0, 6.283); ctx.fill();
|
|
405
|
+
}
|
|
406
|
+
// shooting star
|
|
407
|
+
const ss = pr(t, 9.3, 9.95);
|
|
408
|
+
if (ss > 0 && ss < 1) {
|
|
409
|
+
const e = eOut3(ss), x = b.x0 + b.w * lerp(0.3, 0.62, e), y = b.y0 + b.h * lerp(0.06, 0.4, e);
|
|
410
|
+
const dxp = -b.w * 0.32, dyp = -b.h * 0.34, n = Math.hypot(dxp, dyp);
|
|
411
|
+
const tail = 340 * (1 - ss * 0.6), ux = dxp / n, uy = dyp / n;
|
|
412
|
+
const tg = ctx.createLinearGradient(x, y, x + ux * tail, y + uy * tail);
|
|
413
|
+
const a = Math.sin(ss * Math.PI);
|
|
414
|
+
tg.addColorStop(0, `rgba(255,255,255,${a})`); tg.addColorStop(1, 'rgba(255,255,255,0)');
|
|
415
|
+
ctx.strokeStyle = tg; ctx.lineWidth = 3; ctx.lineCap = 'round';
|
|
416
|
+
ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x + ux * tail, y + uy * tail); ctx.stroke();
|
|
417
|
+
const hg = ctx.createRadialGradient(x, y, 0, x, y, 18);
|
|
418
|
+
hg.addColorStop(0, `rgba(255,255,255,${a})`); hg.addColorStop(1, 'rgba(255,255,255,0)');
|
|
419
|
+
ctx.fillStyle = hg; ctx.fillRect(x - 18, y - 18, 36, 36);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if (moon.vis > 0.01) {
|
|
423
|
+
const mr = 112;
|
|
424
|
+
ctx.save(); ctx.globalAlpha *= moon.vis;
|
|
425
|
+
const halo = ctx.createRadialGradient(moon.x, moon.y, mr * 0.9, moon.x, moon.y, mr * 6);
|
|
426
|
+
halo.addColorStop(0, 'rgba(205,220,255,0.38)'); halo.addColorStop(0.3, 'rgba(190,205,250,0.12)'); halo.addColorStop(1, 'rgba(190,205,250,0)');
|
|
427
|
+
ctx.fillStyle = halo; ctx.fillRect(b.x0, b.y0, b.w, b.h);
|
|
428
|
+
ctx.shadowColor = 'rgba(225,235,255,0.9)'; ctx.shadowBlur = 70;
|
|
429
|
+
const mg = ctx.createRadialGradient(moon.x - mr * 0.35, moon.y - mr * 0.4, 4, moon.x, moon.y, mr);
|
|
430
|
+
mg.addColorStop(0, '#FFFFFF'); mg.addColorStop(0.65, '#ECEFF6'); mg.addColorStop(1, '#C4CBDD');
|
|
431
|
+
ctx.fillStyle = mg; ctx.beginPath(); ctx.arc(moon.x, moon.y, mr, 0, 6.283); ctx.fill();
|
|
432
|
+
ctx.shadowBlur = 0;
|
|
433
|
+
ctx.save(); ctx.beginPath(); ctx.arc(moon.x, moon.y, mr, 0, 6.283); ctx.clip();
|
|
434
|
+
for (const m of maria) {
|
|
435
|
+
const mx = moon.x + m.x * mr, my = moon.y + m.y * mr, r = m.r * mr;
|
|
436
|
+
const g3 = ctx.createRadialGradient(mx, my, 0, mx, my, r);
|
|
437
|
+
g3.addColorStop(0, 'rgba(150,160,190,0.2)'); g3.addColorStop(1, 'rgba(140,152,185,0)');
|
|
438
|
+
ctx.fillStyle = g3; ctx.fillRect(mx - r, my - r, r * 2, r * 2);
|
|
439
|
+
}
|
|
440
|
+
// gentle terminator for roundness
|
|
441
|
+
const tg2 = ctx.createRadialGradient(moon.x - mr * 0.5, moon.y - mr * 0.5, mr * 0.6, moon.x - mr * 0.2, moon.y - mr * 0.2, mr * 1.6);
|
|
442
|
+
tg2.addColorStop(0, 'rgba(60,75,120,0)'); tg2.addColorStop(1, 'rgba(60,75,120,0.35)');
|
|
443
|
+
ctx.fillStyle = tg2; ctx.fillRect(moon.x - mr, moon.y - mr, mr * 2, mr * 2);
|
|
444
|
+
ctx.restore(); ctx.restore();
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
// high wisps (fair weather)
|
|
448
|
+
const wispA = (1 - eIO(pr(t, 2.2, 3.2))) * 0.9 + eIO(pr(t, 10.4, 11.4)) * 0.9;
|
|
449
|
+
if (wispA > 0.01) {
|
|
450
|
+
for (const w of wisps) {
|
|
451
|
+
const x = b.x0 + w.u * b.w - t * w.sp, y = b.y0 + w.v * b.h;
|
|
452
|
+
ctx.save(); ctx.translate(x, y); ctx.scale(1, 0.16);
|
|
453
|
+
const wg = ctx.createRadialGradient(0, 0, 0, 0, 0, w.l);
|
|
454
|
+
wg.addColorStop(0, `rgba(255,255,255,${0.38 * wispA})`); wg.addColorStop(1, 'rgba(255,255,255,0)');
|
|
455
|
+
ctx.fillStyle = wg; ctx.fillRect(-w.l, -w.l, w.l * 2, w.l * 2);
|
|
456
|
+
ctx.restore();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// lightning
|
|
461
|
+
if (t > 6.49 && t < 6.82) {
|
|
462
|
+
let a = 0;
|
|
463
|
+
if (t < 6.6) a = 1; else if (t > 6.66 && t < 6.76) a = 0.85;
|
|
464
|
+
if (a > 0) drawBolt(B1, b.x0 + b.w * 0.56, b.y0 + b.h * 0.12, b.h * 0.74, a, 1.9);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// clouds
|
|
468
|
+
const co = cloudOut(t), dk = darkW(t);
|
|
469
|
+
if (t > 1.85 && co < 1) {
|
|
470
|
+
const light = mix(mix([255, 255, 255], [150, 162, 180], dk), [236, 242, 255], fl * 0.45);
|
|
471
|
+
const shade = mix(mix([178, 194, 214], [52, 64, 82], dk), [150, 170, 215], fl * 0.5);
|
|
472
|
+
const warmRim = (1 - eIO(pr(t, 2.6, 4.2)));
|
|
473
|
+
const unit = Math.min(b.w, b.h) * 0.2;
|
|
474
|
+
for (const c of clouds) {
|
|
475
|
+
const ki = c.storm ? eOut3(pr(t, 4.4 + (c.delay - 2.4), 5.4 + (c.delay - 2.4))) : eOut3(pr(t, 1.9 + c.delay, 3.2 + c.delay));
|
|
476
|
+
if (ki <= 0) continue;
|
|
477
|
+
const drift = -(t - 2) * 24 * c.d - (c.low ? eIO(pr(t, 3.5, 5.0)) * b.w * 0.3 : 0);
|
|
478
|
+
const x = b.x0 + c.u * b.w + (1 - ki) * (b.w * 0.5 + 520) + drift - co * b.w * (0.25 + c.d * 0.3);
|
|
479
|
+
const y = b.y0 + c.v * b.h + Math.sin(t * 0.9 + c.u * 6) * 5;
|
|
480
|
+
this_puffs = c.puffs;
|
|
481
|
+
const lt = mix(light, [255, 240, 205], warmRim * 0.35);
|
|
482
|
+
drawCloud(x, y - co * 40 * c.d, unit * c.s * (1 - 0.12 * co), c.far ? mix(lt, shade, 0.2) : lt, shade, Math.min(1, ki * 1.5) * (c.far ? 0.85 : 1) * (1 - co), 0.18 + dk * 0.22);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// ridges: three layers of land, lit by whatever is in the sky
|
|
487
|
+
const ridgeY = (L, x) => {
|
|
488
|
+
const d = ridgeDef[L], u = x - b.x0 + t * d.drift + L * 300;
|
|
489
|
+
return b.y1 - d.base - d.amp * (0.62 * Math.sin(u * 6.283 * d.f[0] + d.ph[0]) + 0.3 * Math.sin(u * 6.283 * d.f[1] + d.ph[1]) + 0.08 * Math.sin(u * 6.283 * d.f[2] + d.ph[2]));
|
|
490
|
+
};
|
|
491
|
+
{
|
|
492
|
+
const nk = nightW(t), sunL = sun.vis * (t < 9.8 ? sunRise(t) : dawnRise(t));
|
|
493
|
+
const rimCol = mix(mix([255, 255, 255], [255, 214, 120], sunL), [205, 220, 255], nk);
|
|
494
|
+
const rimA = 0.25 + 0.35 * Math.max(sunL, nk * moon.vis) + 0.5 * fl;
|
|
495
|
+
const dwk = eIO(pr(t, 10.0, 11.4));
|
|
496
|
+
if (dwk > 0.01) {
|
|
497
|
+
const hx = sun.x - b.w * 0.12, hy = b.y1 - 270;
|
|
498
|
+
ctx.save(); ctx.translate(hx, hy); ctx.scale(1.6, 0.7);
|
|
499
|
+
const hg2 = ctx.createRadialGradient(0, 0, 0, 0, 0, b.w * 0.5);
|
|
500
|
+
hg2.addColorStop(0, `rgba(255,212,120,${0.9 * dwk})`); hg2.addColorStop(0.4, `rgba(255,222,160,${0.35 * dwk})`); hg2.addColorStop(1, 'rgba(255,226,170,0)');
|
|
501
|
+
ctx.fillStyle = hg2; ctx.fillRect(-b.w * 0.5, -b.w * 0.5, b.w, b.w);
|
|
502
|
+
ctx.restore();
|
|
503
|
+
}
|
|
504
|
+
for (let L = 0; L < 3; L++) {
|
|
505
|
+
const d = ridgeDef[L];
|
|
506
|
+
const dw = eIO(pr(t, 10.0, 11.6));
|
|
507
|
+
const top = mix(mix(pal.wb, [255, 255, 255], 0.06), [118, 146, 204], dw * 0.7), deep = mix(pal.wt, [4, 10, 26], 0.5 + 0.1 * dw);
|
|
508
|
+
const col = mix(mix(top, deep, d.tone), [214, 170, 120], dw * (L === 0 ? 0.28 : 0.08));
|
|
509
|
+
ctx.beginPath(); ctx.moveTo(b.x0 - 4, b.y1 + 4);
|
|
510
|
+
for (let x = b.x0 - 4; x <= b.x1 + 16; x += 12) ctx.lineTo(x, ridgeY(L, x));
|
|
511
|
+
ctx.lineTo(b.x1 + 16, b.y1 + 4); ctx.closePath();
|
|
512
|
+
const rg = ctx.createLinearGradient(0, b.y1 - d.base - d.amp, 0, b.y1);
|
|
513
|
+
rg.addColorStop(0, rgb(mix(col, rimCol, 0.12 + 0.2 * fl))); rg.addColorStop(1, rgb(mix(col, deep, 0.5)));
|
|
514
|
+
ctx.fillStyle = rg; ctx.fill();
|
|
515
|
+
// rim light on the crest
|
|
516
|
+
ctx.beginPath();
|
|
517
|
+
for (let x = b.x0 - 4; x <= b.x1 + 16; x += 12) { const y = ridgeY(L, x) + 1; x === b.x0 - 4 ? ctx.moveTo(x, y) : ctx.lineTo(x, y); }
|
|
518
|
+
ctx.strokeStyle = rgb(rimCol, rimA * [0.7, 0.32, 0.14][L]); ctx.lineWidth = 1.5; ctx.stroke();
|
|
519
|
+
// mist pooling in front of each layer
|
|
520
|
+
const my = b.y1 - d.base + d.amp * 0.6;
|
|
521
|
+
const mg2 = ctx.createLinearGradient(0, my - 60, 0, my + 40);
|
|
522
|
+
mg2.addColorStop(0, rgb(pal.wb, 0)); mg2.addColorStop(0.6, rgb(mix(pal.wb, [255, 255, 255], 0.2), 0.16 * (1 - nk * 0.5))); mg2.addColorStop(1, rgb(pal.wb, 0));
|
|
523
|
+
ctx.fillStyle = mg2; ctx.fillRect(b.x0, my - 60, b.w, 100);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// rain
|
|
528
|
+
const rw = rainW(t);
|
|
529
|
+
if (rw > 0.01) {
|
|
530
|
+
const Hc = b.h + 320;
|
|
531
|
+
ctx.lineCap = 'round';
|
|
532
|
+
ctx.strokeStyle = 'rgba(214,226,244,0.55)';
|
|
533
|
+
for (const d of drops) {
|
|
534
|
+
if (d.on > rw) continue;
|
|
535
|
+
const s = (t * d.v + d.off * Hc) % Hc, yh = b.y0 - 180 + s;
|
|
536
|
+
const xb = b.x0 + d.a * (b.w + 120) - 60;
|
|
537
|
+
const ground = ridgeY(1 + (d.on > 0.5 ? 1 : 0), xb + (b.y1 - 200 - b.y0) * 0.14) + 6;
|
|
538
|
+
if (yh < ground) {
|
|
539
|
+
const x = xb + (yh - b.y0) * 0.14;
|
|
540
|
+
ctx.lineWidth = d.w;
|
|
541
|
+
ctx.beginPath(); ctx.moveTo(x - d.len * 0.14, yh - d.len); ctx.lineTo(x, yh); ctx.stroke();
|
|
542
|
+
} else {
|
|
543
|
+
const age = (yh - ground) / d.v;
|
|
544
|
+
if (age < 0.3) {
|
|
545
|
+
const x = xb + (ground - b.y0) * 0.14, k = age / 0.3;
|
|
546
|
+
ctx.lineWidth = 1.4;
|
|
547
|
+
ctx.strokeStyle = `rgba(214,226,244,${0.6 * (1 - k)})`;
|
|
548
|
+
ctx.beginPath(); ctx.ellipse(x, ground, 6 + k * 34, (6 + k * 34) * 0.2, 0, 0, 6.283); ctx.stroke();
|
|
549
|
+
ctx.fillStyle = `rgba(230,238,250,${0.8 * (1 - k)})`;
|
|
550
|
+
for (const sgn of [-1, 1, 0.4]) {
|
|
551
|
+
const px = x + sgn * age * 140, py = ground - age * 320 + 0.5 * 2600 * age * age;
|
|
552
|
+
if (py <= ground) { ctx.beginPath(); ctx.arc(px, py, 1.8, 0, 6.283); ctx.fill(); }
|
|
553
|
+
}
|
|
554
|
+
ctx.strokeStyle = 'rgba(214,226,244,0.55)';
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
// beads on the glass
|
|
559
|
+
const bw = eIO(pr(t, 4.8, 5.4)) * (1 - eIO(pr(t, 7.6, 8.3)));
|
|
560
|
+
for (const d of beads) {
|
|
561
|
+
const a = eOut3(pr(t, d.t, d.t + 0.18)) * bw;
|
|
562
|
+
if (a < 0.01) continue;
|
|
563
|
+
let y = b.y0 + d.v * b.h; const x = b.x0 + d.u * b.w;
|
|
564
|
+
const sc = 0.7 + 0.3 * a;
|
|
565
|
+
if (d.slide && t > d.t + 0.4) {
|
|
566
|
+
const st = t - d.t - 0.4; const dy = d.sv * st * st;
|
|
567
|
+
// trail
|
|
568
|
+
ctx.strokeStyle = `rgba(220,232,250,${0.18 * a})`; ctx.lineWidth = d.r * 0.6;
|
|
569
|
+
ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x, y + dy); ctx.stroke();
|
|
570
|
+
y += dy;
|
|
571
|
+
}
|
|
572
|
+
const r = d.r * sc;
|
|
573
|
+
ctx.fillStyle = `rgba(5,12,24,${0.22 * a})`; ctx.beginPath(); ctx.arc(x + r * 0.15, y + r * 0.3, r, 0, 6.283); ctx.fill();
|
|
574
|
+
const bg = ctx.createRadialGradient(x, y + r * 0.45, 0, x, y, r);
|
|
575
|
+
bg.addColorStop(0, `rgba(235,242,255,${0.5 * a})`); bg.addColorStop(0.6, `rgba(200,214,236,${0.18 * a})`); bg.addColorStop(1, `rgba(40,55,75,${0.25 * a})`);
|
|
576
|
+
ctx.fillStyle = bg; ctx.beginPath(); ctx.arc(x, y, r, 0, 6.283); ctx.fill();
|
|
577
|
+
ctx.fillStyle = `rgba(255,255,255,${0.85 * a})`; ctx.beginPath(); ctx.arc(x - r * 0.35, y - r * 0.38, r * 0.22, 0, 6.283); ctx.fill();
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// interior light: top sheen + flash fill
|
|
582
|
+
const sheen = ctx.createLinearGradient(0, b.y0, 0, b.y0 + b.h * 0.45);
|
|
583
|
+
sheen.addColorStop(0, 'rgba(255,255,255,0.12)'); sheen.addColorStop(1, 'rgba(255,255,255,0)');
|
|
584
|
+
ctx.fillStyle = sheen; ctx.fillRect(b.x0, b.y0, b.w, b.h);
|
|
585
|
+
const vg = ctx.createLinearGradient(0, b.y1 - b.h * 0.4, 0, b.y1);
|
|
586
|
+
vg.addColorStop(0, 'rgba(0,10,30,0)'); vg.addColorStop(1, 'rgba(0,10,30,0.12)');
|
|
587
|
+
ctx.fillStyle = vg; ctx.fillRect(b.x0, b.y0, b.w, b.h);
|
|
588
|
+
if (fl > 0.01) {
|
|
589
|
+
const bx = b.x0 + b.w * 0.6, by = b.y0 + b.h * 0.45;
|
|
590
|
+
const fg = ctx.createRadialGradient(bx, by, 0, bx, by, b.h * 0.9);
|
|
591
|
+
fg.addColorStop(0, `rgba(225,235,255,${0.55 * fl})`); fg.addColorStop(1, `rgba(200,215,245,${0.06 * fl})`);
|
|
592
|
+
ctx.fillStyle = fg; ctx.fillRect(b.x0, b.y0, b.w, b.h);
|
|
593
|
+
}
|
|
594
|
+
ctx.restore();
|
|
595
|
+
|
|
596
|
+
// lit edge
|
|
597
|
+
rr(b.x0 + 1, b.y0 + 1, b.w - 2, b.h - 2, Math.max(0, b.r - 1));
|
|
598
|
+
const eg = ctx.createLinearGradient(0, b.y0, 0, b.y1);
|
|
599
|
+
eg.addColorStop(0, 'rgba(255,255,255,0.55)'); eg.addColorStop(0.18, 'rgba(255,255,255,0.10)');
|
|
600
|
+
eg.addColorStop(0.8, 'rgba(255,255,255,0.04)'); eg.addColorStop(1, 'rgba(255,255,255,0.16)');
|
|
601
|
+
ctx.strokeStyle = eg; ctx.lineWidth = 2; ctx.stroke();
|
|
602
|
+
ctx.restore();
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// ---------- text ----------
|
|
606
|
+
const words = [[0.55, 2.62], [2.78, 4.6], [4.78, 6.36], [6.5, 7.58], [7.76, 10.08], [10.26, 99]];
|
|
607
|
+
const temps = [[0.45, 1.6], [2.75, 3.7], [4.75, 5.6], [6.5, 6.95], [7.75, 8.8], [10.25, 11.3]].map(([a, z], i) => [a, z, TEMPS[i], TEMPS[i + 1]]);
|
|
608
|
+
let lastTemp = null;
|
|
609
|
+
function drawText(t, b) {
|
|
610
|
+
ui.style.left = b.x0 + 'px'; ui.style.top = b.y0 + 'px';
|
|
611
|
+
ui.style.width = b.w + 'px'; ui.style.height = b.h + 'px';
|
|
612
|
+
ui.style.opacity = b.alpha;
|
|
613
|
+
const s = b.w / b.base.w; // entrance scale
|
|
614
|
+
const padX = (78 + Math.max(0, b.base.r - 150) * 0.55) * s;
|
|
615
|
+
const padT = (70 + Math.max(0, b.base.r - 150) * 0.1) * s;
|
|
616
|
+
words.forEach(([a, z], i) => {
|
|
617
|
+
const el = labs[i];
|
|
618
|
+
const kin = eExpo(pr(t, a, a + 0.7)), kout = eIn(pr(t, z, z + 0.3));
|
|
619
|
+
const punch = i === 3 ? 1 + 0.08 * (1 - eExpo(pr(t, a, a + 0.5))) : 1;
|
|
620
|
+
const y = 46 * (1 - kin) - 30 * kout;
|
|
621
|
+
const op = kin * (1 - kout);
|
|
622
|
+
el.style.opacity = op;
|
|
623
|
+
el.style.transform = `translate(${padX}px, ${padT + y}px) scale(${punch})`;
|
|
624
|
+
el.style.transformOrigin = '0 50%';
|
|
625
|
+
const bl = 12 * (1 - kin) + 8 * kout;
|
|
626
|
+
el.style.filter = bl > 0.2 ? `blur(${bl.toFixed(1)}px)` : 'none';
|
|
627
|
+
});
|
|
628
|
+
let v = TEMPS[0], moving = 0;
|
|
629
|
+
for (const [a, z, f, to] of temps) {
|
|
630
|
+
if (t >= a) { const k = eIO(pr(t, a, z)); v = lerp(f, to, k); if (t < z) moving = 1; }
|
|
631
|
+
}
|
|
632
|
+
const n = Math.round(v);
|
|
633
|
+
if (n !== lastTemp) { tnum.textContent = String(n); lastTemp = n; }
|
|
634
|
+
const intro = eExpo(pr(t, 0.3, 1.2));
|
|
635
|
+
tempEl.style.opacity = intro;
|
|
636
|
+
tempEl.style.transform = `translate(${padX - 14 * s}px, ${-(52 * s) + 30 * (1 - intro)}px)`;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
function draw(t) {
|
|
640
|
+
const b = box(t), pal = palette(t);
|
|
641
|
+
const sun = sunPos(b, t), moon = moonPos(b, t);
|
|
642
|
+
ctx.clearRect(0, 0, W, H);
|
|
643
|
+
drawSky(t, pal, b, sun, moon);
|
|
644
|
+
drawWidget(t, pal, b, sun, moon);
|
|
645
|
+
const fl = flash(t);
|
|
646
|
+
if (fl > 0.01) {
|
|
647
|
+
const fg = ctx.createRadialGradient(W * 0.55, H * 0.3, 0, W * 0.55, H * 0.3, 1400);
|
|
648
|
+
fg.addColorStop(0, `rgba(225,235,255,${0.3 * fl})`); fg.addColorStop(1, `rgba(200,215,245,${0.05 * fl})`);
|
|
649
|
+
ctx.fillStyle = fg; ctx.fillRect(0, 0, W, H);
|
|
650
|
+
}
|
|
651
|
+
// lens vignette
|
|
652
|
+
const vg2 = ctx.createRadialGradient(W / 2, H / 2, H * 0.45, W / 2, H / 2, H * 1.15);
|
|
653
|
+
vg2.addColorStop(0, 'rgba(0,8,24,0)'); vg2.addColorStop(1, 'rgba(0,8,24,0.22)');
|
|
654
|
+
ctx.fillStyle = vg2; ctx.fillRect(0, 0, W, H);
|
|
655
|
+
// film grain
|
|
656
|
+
const fr = Math.floor(t * 30);
|
|
657
|
+
ctx.save();
|
|
658
|
+
ctx.globalAlpha = 0.045; ctx.globalCompositeOperation = 'overlay';
|
|
659
|
+
ctx.translate(-((fr * 97) % 256), -((fr * 61) % 256));
|
|
660
|
+
ctx.fillStyle = grainPat; ctx.fillRect(0, 0, W + 256, H + 256);
|
|
661
|
+
ctx.restore();
|
|
662
|
+
drawText(t, b);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
const tl = gsap.timeline({ paused: true });
|
|
666
|
+
const p = { t: 0 };
|
|
667
|
+
tl.to(p, { t: DUR, duration: DUR, ease: 'none', onUpdate: () => draw(p.t) }, 0);
|
|
668
|
+
window.__timelines = window.__timelines || {};
|
|
669
|
+
window.__timelines['main'] = tl;
|
|
670
|
+
draw(0);
|
|
671
|
+
})();
|
|
672
|
+
</script>
|
|
673
|
+
</body>
|
|
674
|
+
</html>
|