dsh-design-studio 1.5.0 → 2.0.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/README.en.md +6 -5
- package/README.md +7 -6
- package/THIRD_PARTY_NOTICES.md +108 -0
- package/assets/art/README.md +102 -0
- package/assets/art/brand-mark.webp +0 -0
- package/assets/art/check-clean.webp +0 -0
- package/assets/art/coach-markup.webp +0 -0
- package/assets/art/drop-file.webp +0 -0
- package/assets/art/empty-components.webp +0 -0
- package/assets/art/empty-data.webp +0 -0
- package/assets/art/empty-error.webp +0 -0
- package/assets/art/empty-frames.webp +0 -0
- package/assets/art/empty-history.webp +0 -0
- package/assets/art/empty-market.webp +0 -0
- package/assets/art/empty-notes.webp +0 -0
- package/assets/art/empty-search.webp +0 -0
- package/assets/art/empty-tokens.webp +0 -0
- package/assets/art/empty-works.webp +0 -0
- package/assets/art/guide-icon.webp +0 -0
- package/assets/art/kind-app.webp +0 -0
- package/assets/art/kind-desktop.webp +0 -0
- package/assets/art/kind-diagram.webp +0 -0
- package/assets/art/kind-dshplugin.webp +0 -0
- package/assets/art/kind-email.webp +0 -0
- package/assets/art/kind-embedded.webp +0 -0
- package/assets/art/kind-framed.webp +0 -0
- package/assets/art/kind-miniprogram.webp +0 -0
- package/assets/art/kind-poster.webp +0 -0
- package/assets/art/kind-slides.webp +0 -0
- package/assets/art/kind-tablet.webp +0 -0
- package/assets/art/kind-web.webp +0 -0
- package/assets/art/placeholder-inspire-img.webp +0 -0
- package/assets/art/wait-creating.webp +0 -0
- package/assets/demo.gif +0 -0
- package/assets/hero-sm.jpg +0 -0
- package/assets/motion/ai-capsule.html +124 -0
- package/assets/motion/ai-glow-input.html +112 -0
- package/assets/motion/balance-odometer.html +112 -0
- package/assets/motion/bottom-sheet.html +149 -0
- package/assets/motion/brightness-pill.html +114 -0
- package/assets/motion/comet-ring.html +95 -0
- package/assets/motion/copy-morph.html +116 -0
- package/assets/motion/cube-grid.html +103 -0
- package/assets/motion/day-night.html +120 -0
- package/assets/motion/dial-knob.html +130 -0
- package/assets/motion/dock-magnify.html +118 -0
- package/assets/motion/download-ring.html +135 -0
- package/assets/motion/expand-card.html +137 -0
- package/assets/motion/flip-card.html +100 -0
- package/assets/motion/hold-pay.html +137 -0
- package/assets/motion/holo-card.html +130 -0
- package/assets/motion/keycap.html +92 -0
- package/assets/motion/like-jelly.html +88 -0
- package/assets/motion/liquid-progress.html +113 -0
- package/assets/motion/liquid-segment.html +127 -0
- package/assets/motion/live-capsule.html +144 -0
- package/assets/motion/marker-highlight.html +94 -0
- package/assets/motion/marquee-logos.html +110 -0
- package/assets/motion/otp-code.html +111 -0
- package/assets/motion/password-eye.html +136 -0
- package/assets/motion/ruler-slider.html +140 -0
- package/assets/motion/search-expand.html +81 -0
- package/assets/motion/send-fly.html +121 -0
- package/assets/motion/skeleton-shine.html +124 -0
- package/assets/motion/star-rate.html +98 -0
- package/assets/motion/success-check.html +114 -0
- package/assets/motion/suggest-chips.html +134 -0
- package/assets/motion/swipe-row.html +126 -0
- package/assets/motion/tabbar-bounce.html +92 -0
- package/assets/motion/tactile-controls.html +89 -0
- package/assets/motion/text-scramble.html +173 -0
- package/assets/motion/toast-stack.html +115 -0
- package/assets/motion/token-stream.html +106 -0
- package/assets/motion/voice-orb.html +144 -0
- package/assets/showcase/alley-noodles-1.webp +0 -0
- package/assets/showcase/alley-noodles-2.webp +0 -0
- package/assets/showcase/alley-noodles-3.webp +0 -0
- package/assets/showcase/autumn-sale-1.webp +0 -0
- package/assets/showcase/bold-folio-1.webp +0 -0
- package/assets/showcase/bold-folio-2.webp +0 -0
- package/assets/showcase/book-club-1.webp +0 -0
- package/assets/showcase/book-club-2.webp +0 -0
- package/assets/showcase/book-club-3.webp +0 -0
- package/assets/showcase/flower-order-1.webp +0 -0
- package/assets/showcase/little-painter-1.webp +0 -0
- package/assets/showcase/little-painter-2.webp +0 -0
- package/assets/showcase/moon-fair-1.webp +0 -0
- package/assets/showcase/nail-booking-1.webp +0 -0
- package/assets/showcase/nail-booking-2.webp +0 -0
- package/assets/showcase/nail-booking-3.webp +0 -0
- package/assets/showcase/night-run-1.webp +0 -0
- package/assets/showcase/paw-diary-1.webp +0 -0
- package/assets/showcase/paw-diary-2.webp +0 -0
- package/assets/showcase/paw-diary-3.webp +0 -0
- package/assets/showcase/pixel-planet-1.webp +0 -0
- package/assets/showcase/pixel-planet-2.webp +0 -0
- package/assets/showcase/pixel-planet-3.webp +0 -0
- package/assets/showcase/pocket-ledger-1.webp +0 -0
- package/assets/showcase/pocket-ledger-2.webp +0 -0
- package/assets/showcase/shiftloom-1.webp +0 -0
- package/assets/showcase/shiftloom-2.webp +0 -0
- package/assets/showcase/slow-breath-1.webp +0 -0
- package/assets/showcase/slow-breath-2.webp +0 -0
- package/assets/showcase/slow-breath-3.webp +0 -0
- package/assets/showcase/slow-trip-1.webp +0 -0
- package/assets/showcase/slow-trip-2.webp +0 -0
- package/assets/showcase/slow-trip-3.webp +0 -0
- package/assets/showcase/slow-weekly-1.webp +0 -0
- package/assets/showcase/stay-confirm-1.webp +0 -0
- package/assets/showcase/stove-recipes-1.webp +0 -0
- package/assets/showcase/stove-recipes-2.webp +0 -0
- package/assets/showcase/strobewatch-1.webp +0 -0
- package/assets/showcase/strobewatch-2.webp +0 -0
- package/assets/showcase/tapeworks-1.webp +0 -0
- package/assets/showcase/tapeworks-2.webp +0 -0
- package/assets/showcase/tea-brand-pitch-1.webp +0 -0
- package/assets/showcase/tea-brand-pitch-2.webp +0 -0
- package/assets/showcase/tea-brand-pitch-3.webp +0 -0
- package/assets/showcase/time-bookshop-1.webp +0 -0
- package/assets/showcase/time-bookshop-2.webp +0 -0
- package/assets/showcase/water-journey-1.webp +0 -0
- package/assets/showcase/water-journey-2.webp +0 -0
- package/assets/showcase/water-journey-3.webp +0 -0
- package/assets/showcase/weekend-go-1.webp +0 -0
- package/assets/showcase/weekend-go-2.webp +0 -0
- package/assets/showcase/weekend-go-3.webp +0 -0
- package/assets/showcase/winter-soup-1.webp +0 -0
- package/assets/showcase/year-review-1.webp +0 -0
- package/assets/showcase/year-review-2.webp +0 -0
- package/assets/showcase/year-review-3.webp +0 -0
- package/lib/browser.js +3 -1
- package/lib/bundle.js +8 -3
- package/lib/canvthumb.js +9 -6
- package/lib/client.js +7428 -2624
- package/lib/components.js +4 -2
- package/lib/core.js +762 -132
- package/lib/design-page-settings.js +48 -0
- package/lib/design-scope.js +36 -0
- package/lib/design-transactions.js +259 -0
- package/lib/drop-folder.js +25 -0
- package/lib/edits.js +125 -8
- package/lib/embedded/lvgl_shot.c +133 -0
- package/lib/embedded/qml_shot.py +66 -0
- package/lib/embedded-shot.js +400 -0
- package/lib/embedded-trust.js +76 -0
- package/lib/fonts.js +30 -21
- package/lib/frames.js +23 -23
- package/lib/gallery/css.js +9 -2
- package/lib/gallery/market-routes.js +23 -7
- package/lib/gallery/pack.js +25 -8
- package/lib/gallery/policy.js +6 -4
- package/lib/gallery/routes.js +255 -83
- package/lib/gallery/submit.js +285 -57
- package/lib/gallery/use.js +13 -4
- package/lib/handoff-embedded.js +1182 -0
- package/lib/handoff.js +212 -71
- package/lib/history.js +393 -43
- package/lib/htmlpack.js +34 -13
- package/lib/impl.js +3 -0
- package/lib/index.js +661 -136
- package/lib/inspire.js +73 -26
- package/lib/kinds.js +11 -2
- package/lib/look.js +45 -25
- package/lib/mock.js +41 -4
- package/lib/motion.js +90 -0
- package/lib/page-settings.js +103 -0
- package/lib/picker.js +348 -70
- package/lib/rules.js +85 -0
- package/lib/serve.js +154 -15
- package/lib/showcase.json +22 -0
- package/lib/styles.js +16 -7
- package/lib/system.js +19 -8
- package/lib/tool.js +2 -1
- package/lib/tweaks.js +146 -9
- package/lib/works.js +151 -19
- package/locale/auto/en.json +1 -1
- package/locale/auto/zh.json +1 -1
- package/locale/en.json +1 -1
- package/locale/offline/en.json +1 -1
- package/locale/offline/zh.json +2 -2
- package/locale/zh.json +1 -1
- package/package.json +3 -2
- package/skills/ui-design/SKILL.md +56 -46
- package/skills/ui-design/frames/dsh/frame.json +1 -1
- package/skills/ui-design/references/app.md +29 -2
- package/skills/ui-design/references/components.md +1 -1
- package/skills/ui-design/references/desktop.md +1 -1
- package/skills/ui-design/references/dshplugin.md +12 -12
- package/skills/ui-design/references/embedded.md +40 -0
- package/skills/ui-design/references/frames.md +20 -20
- package/skills/ui-design/references/miniprogram.md +2 -2
- package/skills/ui-design/references/mock.md +16 -0
- package/skills/ui-design/references/poster.md +2 -1
- package/skills/ui-design/references/tweaks.md +17 -0
- package/skills/ui-design/tokens.css +19 -5
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title>解码标题</title>
|
|
7
|
+
<script type="application/json" id="meta">{"id":"text-scramble","zh":"解码标题","en":"Text Scramble","cat":"text","desc":"一行字符先乱跳成符号,再从左到右逐个落定成清晰标题","desc_en":"Characters scramble into symbols, then settle left to right into the title","needs":"js","play":"auto","hint":"点一下解码","hint_en":"Tap to decode","source":null,"prompt":"解码标题:圆角质感铭牌内一行等宽大字(12 个固定宽度字符槽,避免解码时横向抖动)。触发后未解码位以 42ms 节奏高频跳变几何与机械符号,约 240ms 后解码前沿从左到右每 105ms 落定一字:前沿位闪主色柔光并轻弹定格,左侧已落定字符呈清晰正文色,下方 2px 细光丝随进度横扫后淡出。按下微缩(scale .96,90ms),点击循环切换短词重播。颜色读 --color-surface / --color-text / --color-muted / --color-line / --color-primary,减少动效直接显示已解码标题。","prompt_en":"Text scramble: a rounded plate, one line of 20px monospace in 12 fixed-width slots. Unsettled slots flip symbols every 42ms; after a 240ms lead the front settles a character every 105ms left to right with a --color-primary glow; a 2px bar tracks progress. Press .96 (90ms); tap plays the next word. Reads --color-surface / --color-text / --color-muted / --color-line / --color-primary; reduced motion: final title."}</script>
|
|
8
|
+
<style data-stage>
|
|
9
|
+
:root{color-scheme:light;--color-bg:#efede7;--color-surface:#fff;--color-text:#141413;--color-muted:#8a8984;--color-line:rgba(20,20,19,.1);--color-primary:#0a84ff;--color-danger:#ff375f;--color-warning:#ffb340;--color-success:#2eb85c;--font-sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","PingFang SC","Microsoft YaHei",system-ui,sans-serif}
|
|
10
|
+
:root[data-theme=dark]{color-scheme:dark;--color-bg:#17171a;--color-surface:#2c2c30;--color-text:#f5f5f4;--color-muted:#8e8d88;--color-line:rgba(255,255,255,.14);--color-primary:#38bdf8}
|
|
11
|
+
html,body{height:100%;margin:0}
|
|
12
|
+
body{display:grid;place-items:center;background:var(--color-bg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;overflow:hidden;user-select:none;-webkit-user-select:none}
|
|
13
|
+
.paused *{animation-play-state:paused!important}
|
|
14
|
+
.stage-fit{position:absolute;left:50%;top:50%;width:max-content;display:grid;place-items:center;transform:translate(-50%,-50%) scale(var(--fit,1))}
|
|
15
|
+
</style>
|
|
16
|
+
<style data-comp>
|
|
17
|
+
/* 解码标题 · 等宽字符槽逐个从乱码符号落定为真文字。颜色读设计变量:--color-surface / --color-text / --color-muted / --color-line / --color-primary */
|
|
18
|
+
.c-text-scramble{--tx-acc:var(--color-primary,#0a84ff);--tx-p:1;--tx-spring:linear(0,.05,.18,.36,.56,.75,.91,1.03,1.1,1.12,1.11,1.08,1.04,1.01,.98,.97,.97,.98,.99,1,1.01,1.01,1.01,1,1);position:relative;padding:0;border:0;border-radius:18px;background:var(--color-surface,#fff);box-shadow:inset 0 1px 0 rgba(255,255,255,.32),0 0 0 .5px var(--color-line,rgba(0,0,0,.1)),0 2px 5px rgba(0,0,0,.06),0 16px 34px -12px rgba(0,0,0,.28);cursor:pointer;outline:none;transition:transform .54s var(--tx-spring),box-shadow .35s ease;-webkit-tap-highlight-color:transparent;font-family:var(--font-sans,system-ui)}
|
|
19
|
+
.c-text-scramble:hover{transform:translateY(-1px)}
|
|
20
|
+
.c-text-scramble:active,.c-text-scramble.is-press{transform:scale(.96);transition:transform .09s cubic-bezier(.3,0,.5,1)}
|
|
21
|
+
.c-text-scramble:focus-visible{outline:2px solid var(--tx-acc);outline-offset:4px}
|
|
22
|
+
.c-text-scramble .tx-body{position:relative;display:flex;align-items:center;gap:11px;padding:18px 22px 20px;overflow:hidden;border-radius:inherit}
|
|
23
|
+
.c-text-scramble .tx-dot{width:7px;height:7px;flex:none;border-radius:50%;background:var(--color-success,#2eb85c);box-shadow:0 0 0 3px color-mix(in srgb,var(--color-success,#2eb85c) 22%,transparent);transition:background-color .24s ease,box-shadow .24s ease}
|
|
24
|
+
.c-text-scramble.is-run .tx-dot{background:var(--tx-acc);box-shadow:0 0 8px 1px color-mix(in srgb,var(--tx-acc) 72%,transparent);animation:tx-blink .42s ease-in-out infinite}
|
|
25
|
+
.c-text-scramble .tx-line{display:inline-flex;align-items:center;font:700 20px/1 ui-monospace,"SF Mono",SFMono-Regular,Menlo,Monaco,Consolas,monospace;letter-spacing:.04em;color:var(--color-text,#141413)}
|
|
26
|
+
.c-text-scramble .tx-ch{display:inline-grid;place-items:center;width:1.06ch;height:1.25em;transition:color .18s ease,opacity .18s ease}
|
|
27
|
+
.c-text-scramble .tx-ch.is-sp{width:.62ch}
|
|
28
|
+
.c-text-scramble .tx-ch.is-noise{color:var(--color-muted,#8a8984);opacity:.68}
|
|
29
|
+
.c-text-scramble .tx-ch.is-edge{color:var(--tx-acc);opacity:1;text-shadow:0 0 10px color-mix(in srgb,var(--tx-acc) 65%,transparent)}
|
|
30
|
+
.c-text-scramble .tx-ch.is-hit{animation:tx-snap .32s var(--tx-spring)}
|
|
31
|
+
.c-text-scramble .tx-bar{position:absolute;left:18px;right:18px;bottom:8px;height:2px;border-radius:2px;background:color-mix(in srgb,var(--color-text,#141413) 7%,transparent);overflow:hidden;opacity:0;transition:opacity .32s ease}
|
|
32
|
+
.c-text-scramble.is-run .tx-bar{opacity:1}
|
|
33
|
+
.c-text-scramble .tx-fill{display:block;width:100%;height:100%;border-radius:inherit;background:linear-gradient(90deg,color-mix(in srgb,var(--tx-acc) 35%,transparent),var(--tx-acc));transform-origin:0 50%;transform:scaleX(var(--tx-p))}
|
|
34
|
+
@keyframes tx-snap{0%{transform:translateY(-2px) scale(1.16);color:var(--tx-acc)}100%{transform:none;color:var(--color-text,#141413)}}
|
|
35
|
+
@keyframes tx-blink{50%{opacity:.35;transform:scale(.82)}}
|
|
36
|
+
@media (prefers-reduced-motion:reduce){.c-text-scramble *{animation:none!important;transition-duration:.01ms!important}}
|
|
37
|
+
</style>
|
|
38
|
+
</head>
|
|
39
|
+
<body>
|
|
40
|
+
<div class="stage-fit">
|
|
41
|
+
<button class="c-text-scramble" data-comp="text-scramble" type="button" aria-label="点击重新解码标题" data-words="MOTION CRAFT|SPRING LOGIC|FLUID SIGNAL">
|
|
42
|
+
<span class="tx-body">
|
|
43
|
+
<span class="tx-dot" aria-hidden="true"></span>
|
|
44
|
+
<span class="tx-line" aria-live="polite"></span>
|
|
45
|
+
<span class="tx-bar" aria-hidden="true"><span class="tx-fill"></span></span>
|
|
46
|
+
</span>
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
<script data-comp>
|
|
50
|
+
/* 解码标题逻辑:每字符固定宽度槽位,乱码高频跳变,从左到右逐个落定。支持一页多个实例。 */
|
|
51
|
+
(() => {
|
|
52
|
+
const GLYPHS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/#*+=<>[]'
|
|
53
|
+
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
54
|
+
document.querySelectorAll('.c-text-scramble').forEach((el) => {
|
|
55
|
+
const line = el.querySelector('.tx-line')
|
|
56
|
+
const words = (el.dataset.words || 'MOTION CRAFT').split('|')
|
|
57
|
+
let idx = 0, raf = 0, lastSwap = 0, spans = []
|
|
58
|
+
|
|
59
|
+
const mount = (word) => {
|
|
60
|
+
line.innerHTML = ''
|
|
61
|
+
spans = [...word].map((ch) => {
|
|
62
|
+
const s = document.createElement('span')
|
|
63
|
+
s.className = 'tx-ch' + (ch === ' ' ? ' is-sp' : '')
|
|
64
|
+
s.textContent = ch
|
|
65
|
+
line.append(s)
|
|
66
|
+
return s
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
el.txSettle = (i = 0) => {
|
|
71
|
+
cancelAnimationFrame(raf); raf = 0
|
|
72
|
+
idx = i % words.length
|
|
73
|
+
mount(words[idx])
|
|
74
|
+
el.classList.remove('is-run')
|
|
75
|
+
el.style.setProperty('--tx-p', '1')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
el.txPlay = (nextWord = false, onDone) => {
|
|
79
|
+
cancelAnimationFrame(raf); raf = 0
|
|
80
|
+
if (nextWord) idx = (idx + 1) % words.length
|
|
81
|
+
const target = words[idx]
|
|
82
|
+
mount(target)
|
|
83
|
+
if (reduced) { el.classList.remove('is-run'); el.style.setProperty('--tx-p', '1'); onDone && onDone(); return }
|
|
84
|
+
|
|
85
|
+
el.classList.add('is-run')
|
|
86
|
+
el.style.setProperty('--tx-p', '0')
|
|
87
|
+
const len = target.length
|
|
88
|
+
const lead = 240, stepMs = 105
|
|
89
|
+
const t0 = performance.now()
|
|
90
|
+
let locked = -1
|
|
91
|
+
lastSwap = 0
|
|
92
|
+
|
|
93
|
+
const frame = (now) => {
|
|
94
|
+
if (document.documentElement.classList.contains('paused')) { raf = requestAnimationFrame(frame); return }
|
|
95
|
+
const elapsed = now - t0
|
|
96
|
+
const cur = Math.min(len, Math.floor((elapsed - lead) / stepMs))
|
|
97
|
+
const swap = now - lastSwap >= 42
|
|
98
|
+
if (swap) lastSwap = now
|
|
99
|
+
|
|
100
|
+
for (let i = 0; i < len; i++) {
|
|
101
|
+
const s = spans[i]
|
|
102
|
+
if (target[i] === ' ') { s.textContent = ' '; continue }
|
|
103
|
+
if (i < cur) {
|
|
104
|
+
if (i >= locked) {
|
|
105
|
+
s.textContent = target[i]
|
|
106
|
+
s.classList.remove('is-noise', 'is-edge')
|
|
107
|
+
s.classList.add('is-hit')
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
if (swap || i === cur) {
|
|
111
|
+
s.textContent = GLYPHS[(Math.random() * GLYPHS.length) | 0]
|
|
112
|
+
}
|
|
113
|
+
s.classList.toggle('is-edge', i === cur || i === cur + 1)
|
|
114
|
+
s.classList.toggle('is-noise', i > cur + 1)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (cur > locked) locked = cur
|
|
118
|
+
el.style.setProperty('--tx-p', Math.max(0, Math.min(1, cur / len)).toFixed(3))
|
|
119
|
+
|
|
120
|
+
if (cur >= len) {
|
|
121
|
+
raf = 0
|
|
122
|
+
el.classList.remove('is-run')
|
|
123
|
+
onDone && onDone()
|
|
124
|
+
} else {
|
|
125
|
+
raf = requestAnimationFrame(frame)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
raf = requestAnimationFrame(frame)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
el.txStop = () => { cancelAnimationFrame(raf); raf = 0 }
|
|
132
|
+
el.addEventListener('click', () => el.txPlay(true))
|
|
133
|
+
el.txSettle(0)
|
|
134
|
+
})
|
|
135
|
+
})()
|
|
136
|
+
</script>
|
|
137
|
+
<script data-stage>
|
|
138
|
+
/* 演示舞台:每个组件都一样,只改 DEMO 那一段。组件按 340×212 设计,卡片小了整体等比缩小。 */
|
|
139
|
+
(() => {
|
|
140
|
+
const q = new URLSearchParams(location.search); const root = document.documentElement
|
|
141
|
+
root.dataset.theme = (q.get('theme') || (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) === 'dark' ? 'dark' : 'light'
|
|
142
|
+
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
143
|
+
const el = document.querySelector('.stage-fit > [data-comp]')
|
|
144
|
+
const fit = () => root.style.setProperty('--fit', Math.min(1, innerWidth / 340, innerHeight / 212).toFixed(3))
|
|
145
|
+
fit(); addEventListener('resize', fit)
|
|
146
|
+
let playing = !q.has('still'); let hovering = false; let timers = []
|
|
147
|
+
const later = (fn, ms) => timers.push(setTimeout(() => { if (playing && !hovering) fn() }, ms)) // 演示用的定时器:用户一来就全部作废
|
|
148
|
+
const stop = () => { timers.forEach(clearTimeout); timers = []; DEMO.stop() }
|
|
149
|
+
const go = (ms) => { stop(); if (playing && !hovering && !reduced) later(() => DEMO.loop(later), ms) }
|
|
150
|
+
// ===== 只改这一段 =====
|
|
151
|
+
let first = true
|
|
152
|
+
const DEMO = {
|
|
153
|
+
settle () { el.txSettle(0) }, // 落定状态:完整清晰标题
|
|
154
|
+
loop (later) {
|
|
155
|
+
const next = !first; first = false
|
|
156
|
+
el.txPlay(next, () => later(() => DEMO.loop(later), 1100))
|
|
157
|
+
},
|
|
158
|
+
stop () { el.classList.remove('is-press') },
|
|
159
|
+
}
|
|
160
|
+
// =====================
|
|
161
|
+
document.body.addEventListener('pointerenter', () => { hovering = true; stop() })
|
|
162
|
+
document.body.addEventListener('pointerleave', () => { hovering = false; go(1400) })
|
|
163
|
+
addEventListener('message', (e) => {
|
|
164
|
+
const d = e.data; if (!d || typeof d !== 'object') return
|
|
165
|
+
if (d.theme === 'light' || d.theme === 'dark') root.dataset.theme = d.theme
|
|
166
|
+
if (typeof d.ddpPlay === 'boolean') { playing = d.ddpPlay; root.classList.toggle('paused', !playing); if (playing) go(400); else stop() }
|
|
167
|
+
})
|
|
168
|
+
try { parent.postMessage({ ddpMotionReady: 1 }, '*') } catch (e) { /* 单独打开时没有外层 */ }
|
|
169
|
+
if (reduced || q.has('still')) DEMO.settle(); else go(600)
|
|
170
|
+
})()
|
|
171
|
+
</script>
|
|
172
|
+
</body>
|
|
173
|
+
</html>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title>通知叠放</title>
|
|
7
|
+
<script type="application/json" id="meta">{"id":"toast-stack","zh":"通知叠放","en":"Stacked Toasts","cat":"loading","desc":"新通知从上面滑进来,旧的往后缩成一叠;鼠标放上去整叠展开","desc_en":"New toasts slide in from the top and older ones tuck behind; hover to fan them out","needs":"js","play":"press","hint":"点一下","hint_en":"Tap","source":{"name":"Sonner","url":"https://github.com/emilkowalski/sonner/blob/main/src/styles.css","license":"MIT","author":"2023 Emil Kowalski"},"prompt":"通知叠放:236×48 的通知条(--color-surface、14px 圆角、发丝边、两层阴影;左边 28px 彩色图标块,右边标题+一行小字),最多露 3 条。照 Sonner:后面第 i 条下移 i×14px、缩小 i×5%,内容淡掉只剩卡片;新通知从 -110% 滑入并淡入,第 4 条淡出后删掉。鼠标放上去(或获得焦点)整叠展开成列表,第 i 条在 i×(48+14)px,整组同时上移居中。过渡 .45s 带一点过冲的弹簧 linear()。点一下来一条新的,按住缩到 .97。减少动效时直接到位。","prompt_en":"Toasts: 236×48 (--color-surface, 14px radius, hairline, 28px icon, title + subline), 3 visible. Per Sonner, the i-th behind sits i×14px lower at scale 1−i×5%, content hidden; new ones slide and fade in from -110%; the 4th fades and is removed. Hover or focus fans them into a list at i×(48+14)px as the group shifts up. .45s linear() spring, slight overshoot. Tap adds one; press .97. Reduced motion: instant."}</script>
|
|
8
|
+
<style data-stage>
|
|
9
|
+
:root{color-scheme:light;--color-bg:#efede7;--color-surface:#fff;--color-text:#141413;--color-muted:#76756f;--color-line:rgba(20,20,19,.1);--color-primary:#0a84ff;--color-danger:#ff375f;--color-warning:#ffb340;--font-sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","PingFang SC","Microsoft YaHei",system-ui,sans-serif}
|
|
10
|
+
:root[data-theme=dark]{color-scheme:dark;--color-bg:#17171a;--color-surface:#2c2c30;--color-text:#f5f5f4;--color-muted:#8e8d88;--color-line:rgba(255,255,255,.1)}
|
|
11
|
+
html,body{height:100%;margin:0}
|
|
12
|
+
body{display:grid;place-items:center;background:var(--color-bg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;overflow:hidden;user-select:none;-webkit-user-select:none}
|
|
13
|
+
.paused *{animation-play-state:paused!important}
|
|
14
|
+
.stage-fit{position:absolute;left:50%;top:50%;width:max-content;display:grid;place-items:center;transform:translate(-50%,-50%) scale(var(--fit,1))}
|
|
15
|
+
</style>
|
|
16
|
+
<style data-comp>
|
|
17
|
+
/* 通知叠放 · 改写自 Sonner(MIT,© 2023 Emil Kowalski,https://github.com/emilkowalski/sonner)
|
|
18
|
+
照 src/styles.css 的叠放算法(收起时后面第 i 条 translateY(i×gap) 且 scale(1−i×.05)、内容隐藏;展开时 translateY(offset))
|
|
19
|
+
和 src/index.tsx 的 VISIBLE_TOASTS_AMOUNT=3、GAP=14。原版是 React + 量高度,这里条高固定 48px,改成原生 JS + CSS 变量。
|
|
20
|
+
脚本只给每条写 --i(第几条)和 on / gone 两个 class。读 --color-surface / --color-text / --color-muted / --color-line / --color-primary 等 */
|
|
21
|
+
.c-toast-stack{--ts-h:48px;--ts-gap:14px;--ts-spring:linear(0,.09,.3,.54,.75,.9,1,1.05,1.07,1.065,1.05,1.033,1.018,1.007,1,.996,.995,.996,.998,1);position:relative;width:252px;height:172px;outline:none;cursor:pointer;font-family:var(--font-sans,system-ui);-webkit-tap-highlight-color:transparent}
|
|
22
|
+
.c-toast-stack .ts-list{position:absolute;left:8px;right:8px;top:0;height:var(--ts-h);transform:translateY(46px);transition:transform .45s var(--ts-spring)}
|
|
23
|
+
.c-toast-stack .ts-t{--i:0;position:absolute;inset:0;z-index:calc(10 - var(--i));display:flex;align-items:center;gap:10px;padding:0 12px;box-sizing:border-box;border-radius:14px;background:var(--color-surface,#fff);box-shadow:inset 0 1px 0 rgba(255,255,255,.45),0 0 0 .5px var(--color-line,rgba(0,0,0,.1)),0 1px 2px rgba(0,0,0,.06),0 10px 24px -10px rgba(0,0,0,.28);transform-origin:50% 100%;transform:translateY(calc(var(--i)*var(--ts-gap))) scale(calc(1 - var(--i)*.05));transition:transform .45s var(--ts-spring),opacity .4s,scale .5s cubic-bezier(.3,1.6,.5,1)}
|
|
24
|
+
.c-toast-stack .ts-t:not(.on){transform:translateY(-110%) scale(.96);opacity:0}
|
|
25
|
+
.c-toast-stack .ts-t.gone{opacity:0}
|
|
26
|
+
.c-toast-stack .ts-t>*{transition:opacity .4s}
|
|
27
|
+
.c-toast-stack .ts-t:not(:first-child)>*{opacity:0}
|
|
28
|
+
.c-toast-stack:hover .ts-list,.c-toast-stack:focus-visible .ts-list,.c-toast-stack.is-open .ts-list{transform:translateY(0)}
|
|
29
|
+
.c-toast-stack:hover .ts-t.on,.c-toast-stack:focus-visible .ts-t.on,.c-toast-stack.is-open .ts-t.on{transform:translateY(calc(var(--i)*(var(--ts-h) + var(--ts-gap))))}
|
|
30
|
+
.c-toast-stack:hover .ts-t.gone,.c-toast-stack:focus-visible .ts-t.gone,.c-toast-stack.is-open .ts-t.gone{transform:translateY(calc(2*(var(--ts-h) + var(--ts-gap)) + 8px)) scale(.94)}
|
|
31
|
+
.c-toast-stack:hover .ts-t>*,.c-toast-stack:focus-visible .ts-t>*,.c-toast-stack.is-open .ts-t>*{opacity:1}
|
|
32
|
+
.c-toast-stack:hover .ts-t.gone>*,.c-toast-stack.is-open .ts-t.gone>*{opacity:0}
|
|
33
|
+
.c-toast-stack .ts-t:first-child:active,.c-toast-stack.is-press .ts-t:first-child{scale:.97;transition:transform .45s var(--ts-spring),opacity .4s,scale .12s}
|
|
34
|
+
.c-toast-stack:focus-visible .ts-t:first-child{box-shadow:0 0 0 2px var(--color-primary,#0a84ff),0 10px 24px -10px rgba(0,0,0,.28)}
|
|
35
|
+
.c-toast-stack .ts-ic{flex:none;width:28px;height:28px;border-radius:8px;display:grid;place-items:center;color:#fff;background:var(--k);box-shadow:inset 0 1px 0 rgba(255,255,255,.35)}
|
|
36
|
+
.c-toast-stack .ts-ic svg{width:16px;height:16px}
|
|
37
|
+
.c-toast-stack .ts-tx{min-width:0;display:grid;gap:2px}
|
|
38
|
+
.c-toast-stack .ts-tx b{font-size:13px;font-weight:600;line-height:16px;color:var(--color-text,#141413);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
39
|
+
.c-toast-stack .ts-tx span{font-size:11.5px;line-height:14px;color:var(--color-muted,#76756f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
40
|
+
@media (prefers-reduced-motion:reduce){.c-toast-stack *{transition:none!important}}
|
|
41
|
+
</style>
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
<div class="stage-fit">
|
|
45
|
+
<div class="c-toast-stack" data-comp="toast-stack" tabindex="0" role="log" aria-label="通知,点一下来一条新的"><div class="ts-list"></div></div>
|
|
46
|
+
</div>
|
|
47
|
+
<script data-comp>
|
|
48
|
+
/* 通知叠放逻辑:最新的在第 0 条;新来的先挂上(不带 on)下一帧再加 on 滑进来;第 4 条淡出后删掉。一页可放多个。 */
|
|
49
|
+
(() => {
|
|
50
|
+
const VISIBLE = 3 // Sonner 的 VISIBLE_TOASTS_AMOUNT
|
|
51
|
+
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
52
|
+
const ic = (d) => `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`
|
|
53
|
+
const MSG = [ // 虚构内容
|
|
54
|
+
['包裹已到驿站', '取件码 6-2-18', 'var(--color-warning,#ffb340)', ic('<path d="M2.5 5 8 2.2 13.5 5v6L8 13.8 2.5 11zM2.5 5 8 7.8 13.5 5M8 7.8v6"/>')],
|
|
55
|
+
['小满', '周末一起去爬山吗?', 'var(--color-primary,#0a84ff)', ic('<path d="M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H7l-3 2.5v-2.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1z"/>')],
|
|
56
|
+
['照片已备份', '刚刚备份了 128 张', 'var(--color-success,#30c25a)', ic('<path d="M4.5 12.5a3 3 0 0 1-.4-6 4 4 0 0 1 7.8 0 3 3 0 0 1-.4 6zM6 9.2l1.5 1.5L10.2 8"/>')],
|
|
57
|
+
['设计周会', '10 分钟后,3 号会议室', 'var(--color-danger,#ff375f)', ic('<rect x="2.5" y="3.5" width="11" height="10" rx="2"/><path d="M2.5 7h11M5.5 2v3m5-3v3"/>')],
|
|
58
|
+
]
|
|
59
|
+
document.querySelectorAll('.c-toast-stack').forEach((el) => {
|
|
60
|
+
const list = el.querySelector('.ts-list'); let n = 0
|
|
61
|
+
const make = (m) => { const t = document.createElement('div'); t.className = 'ts-t'; t.innerHTML = `<span class="ts-ic" style="--k:${m[2]}">${m[3]}</span><span class="ts-tx"><b>${m[0]}</b><span>${m[1]}</span></span>`; return t }
|
|
62
|
+
const reindex = () => [...list.children].forEach((t, i) => { t.style.setProperty('--i', i); t.classList.toggle('gone', i >= VISIBLE); if (i >= VISIBLE && !t.dataset.bye) { t.dataset.bye = 1; setTimeout(() => t.remove(), reduced ? 0 : 450) } })
|
|
63
|
+
const push = () => {
|
|
64
|
+
const t = make(MSG[n++ % MSG.length]); list.prepend(t); reindex()
|
|
65
|
+
if (reduced) t.classList.add('on'); else { void t.offsetWidth; t.classList.add('on') }
|
|
66
|
+
}
|
|
67
|
+
for (let k = 0; k < VISIBLE; k++) { const t = make(MSG[n++ % MSG.length]); t.classList.add('on'); list.prepend(t) } // 落定:先叠好 3 条
|
|
68
|
+
reindex()
|
|
69
|
+
el.addEventListener('click', push)
|
|
70
|
+
el.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); push() } })
|
|
71
|
+
el.tsPush = push // 给演示舞台用
|
|
72
|
+
})
|
|
73
|
+
})()
|
|
74
|
+
</script>
|
|
75
|
+
<script data-stage>
|
|
76
|
+
/* 演示舞台:每个组件都一样,只改 DEMO 那一段。组件按 340×212 设计,卡片小了整体等比缩小。 */
|
|
77
|
+
(() => {
|
|
78
|
+
const q = new URLSearchParams(location.search); const root = document.documentElement
|
|
79
|
+
root.dataset.theme = (q.get('theme') || (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) === 'dark' ? 'dark' : 'light'
|
|
80
|
+
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
81
|
+
const el = document.querySelector('.stage-fit > [data-comp]')
|
|
82
|
+
const fit = () => root.style.setProperty('--fit', Math.min(1, innerWidth / 340, innerHeight / 212).toFixed(3))
|
|
83
|
+
fit(); addEventListener('resize', fit)
|
|
84
|
+
let playing = !q.has('still'); let hovering = false; let timers = []
|
|
85
|
+
const later = (fn, ms) => timers.push(setTimeout(() => { if (playing && !hovering) fn() }, ms)) // 演示用的定时器:用户一来就全部作废
|
|
86
|
+
const stop = () => { timers.forEach(clearTimeout); timers = []; DEMO.stop() }
|
|
87
|
+
const go = (ms) => { stop(); if (playing && !hovering && !reduced) later(() => DEMO.loop(later), ms) }
|
|
88
|
+
// ===== 只改这一段 =====
|
|
89
|
+
const DEMO = {
|
|
90
|
+
settle () {}, // 落定:3 条收成一叠
|
|
91
|
+
loop (later) {
|
|
92
|
+
later(() => el.classList.add('is-press'), 880) // 像手指点一下:按下 → 松手来一条新的
|
|
93
|
+
later(() => { el.classList.remove('is-press'); el.tsPush() }, 1000)
|
|
94
|
+
later(() => el.classList.add('is-press'), 1780)
|
|
95
|
+
later(() => { el.classList.remove('is-press'); el.tsPush() }, 1900)
|
|
96
|
+
later(() => el.classList.add('is-open'), 2600)
|
|
97
|
+
later(() => el.classList.remove('is-open'), 4300)
|
|
98
|
+
later(() => DEMO.loop(later), 5000)
|
|
99
|
+
},
|
|
100
|
+
stop () { el.classList.remove('is-open', 'is-press') },
|
|
101
|
+
}
|
|
102
|
+
// =====================
|
|
103
|
+
document.body.addEventListener('pointerenter', () => { hovering = true; stop() })
|
|
104
|
+
document.body.addEventListener('pointerleave', () => { hovering = false; go(1400) })
|
|
105
|
+
addEventListener('message', (e) => {
|
|
106
|
+
const d = e.data; if (!d || typeof d !== 'object') return
|
|
107
|
+
if (d.theme === 'light' || d.theme === 'dark') root.dataset.theme = d.theme
|
|
108
|
+
if (typeof d.ddpPlay === 'boolean') { playing = d.ddpPlay; root.classList.toggle('paused', !playing); if (playing) go(400); else stop() }
|
|
109
|
+
})
|
|
110
|
+
try { parent.postMessage({ ddpMotionReady: 1 }, '*') } catch (e) { /* 单独打开时没有外层 */ }
|
|
111
|
+
if (reduced || q.has('still')) DEMO.settle(); else go(600)
|
|
112
|
+
})()
|
|
113
|
+
</script>
|
|
114
|
+
</body>
|
|
115
|
+
</html>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title>逐字回复</title>
|
|
7
|
+
<script type="application/json" id="meta">{"id": "token-stream", "zh": "逐字回复", "en": "Streaming Reply", "cat": "ai", "desc": "先闪一道光在想,再一个词一个词浮出来","desc_en":"A shimmer while thinking, then words float in one by one", "needs": "js", "play": "auto", "hint": "点一下重来","hint_en":"Tap to replay", "source": null, "prompt": "逐字回复:一张对话气泡卡。先显示一行「在想…」,文字上有一道斜向流光扫过(background-clip:text);随后回答按词出现,每个词从 4px 模糊 + 下移 4px + 透明淡入成清晰(260ms),后面跟一个呼吸的竖线光标;写完光标淡出,底部淡入两个小图标按钮(复制、重写)。点卡片重播。颜色读 --color-surface / --color-text / --color-muted / --color-primary,开了减少动效就直接显示全文。", "prompt_en": "Streaming reply in a chat bubble. First a thinking line with a diagonal shimmer (background-clip:text); then the answer appears word by word, each fading from 4px blur and 4px lower to sharp (260ms), followed by a blinking caret. When done the caret fades and two icon buttons (copy, rewrite) fade in. Tap to replay. Reads --color-surface / --color-text / --color-muted / --color-primary; reduced motion: full text."}</script>
|
|
8
|
+
<style data-stage>
|
|
9
|
+
:root{color-scheme:light;--color-bg:#efede7;--color-surface:#fff;--color-text:#141413;--color-muted:#8a8984;--color-line:rgba(20,20,19,.1);--color-primary:#6d5dfc;--font-sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","PingFang SC","Microsoft YaHei",system-ui,sans-serif}
|
|
10
|
+
:root[data-theme=dark]{color-scheme:dark;--color-bg:#17171a;--color-surface:#2c2c30;--color-text:#f5f5f4;--color-muted:#8e8d88;--color-line:rgba(255,255,255,.1);--color-primary:#9d8cff}
|
|
11
|
+
html,body{height:100%;margin:0}
|
|
12
|
+
body{display:grid;place-items:center;background:var(--color-bg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;overflow:hidden;user-select:none;-webkit-user-select:none}
|
|
13
|
+
.paused *{animation-play-state:paused!important}
|
|
14
|
+
.stage-fit{position:absolute;left:50%;top:50%;width:max-content;display:grid;place-items:center;transform:translate(-50%,-50%) scale(var(--fit,1))}
|
|
15
|
+
</style>
|
|
16
|
+
<style data-comp>
|
|
17
|
+
/* 逐字回复。颜色读设计变量:--color-surface / --color-text / --color-muted / --color-primary */
|
|
18
|
+
.c-token-stream{--ts-acc:var(--color-primary,#6d5dfc);position:relative;width:264px;max-width:100%;min-height:118px;box-sizing:border-box;padding:14px 16px 12px;border-radius:20px 20px 20px 6px;background:var(--color-surface,#fff);box-shadow:0 0 0 .5px var(--color-line,rgba(0,0,0,.1)),0 2px 4px rgba(0,0,0,.05),0 16px 34px -14px rgba(0,0,0,.3);font:400 14px/1.6 var(--font-sans,system-ui);color:var(--color-text,#141413);cursor:pointer}
|
|
19
|
+
.c-token-stream .ts-who{display:flex;align-items:center;gap:7px;margin-bottom:6px;font-size:12px;font-weight:600;color:var(--color-muted,#8a8984)}
|
|
20
|
+
.c-token-stream .ts-orb{width:16px;height:16px;border-radius:50%;background:conic-gradient(from 0deg,#ff8a5b,var(--ts-acc),#45c4ff,#ff8a5b);box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.45)}
|
|
21
|
+
.c-token-stream.think .ts-orb{animation:ts-spin 1.6s linear infinite}
|
|
22
|
+
.c-token-stream .ts-think{display:none;font-weight:500;background:linear-gradient(100deg,var(--color-muted,#8a8984) 0 35%,var(--color-text,#141413) 50%,var(--color-muted,#8a8984) 65% 100%) 0 0/250% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:ts-shine 1.4s linear infinite}
|
|
23
|
+
.c-token-stream.think .ts-think{display:block}
|
|
24
|
+
.c-token-stream .ts-out{min-height:44px}
|
|
25
|
+
.c-token-stream .ts-out span{display:inline;animation:ts-in .26s cubic-bezier(.2,.8,.2,1) both}
|
|
26
|
+
.c-token-stream .ts-caret{display:inline-block;width:2px;height:1.05em;margin-left:2px;vertical-align:-.15em;border-radius:1px;background:var(--ts-acc);animation:ts-blink 1s ease-in-out infinite}
|
|
27
|
+
.c-token-stream.done .ts-caret{opacity:0;transition:opacity .3s;animation:none}
|
|
28
|
+
.c-token-stream .ts-acts{display:flex;gap:2px;margin:6px 0 0 -6px;opacity:0;transform:translateY(4px);transition:opacity .3s,transform .35s cubic-bezier(.2,.8,.2,1)}
|
|
29
|
+
.c-token-stream.done .ts-acts{opacity:1;transform:none}
|
|
30
|
+
.c-token-stream .ts-acts button{width:28px;height:28px;border:0;border-radius:8px;background:transparent;color:var(--color-muted,#8a8984);display:grid;place-items:center;cursor:pointer}
|
|
31
|
+
.c-token-stream .ts-acts button:hover{background:color-mix(in srgb,var(--color-text,#141413) 7%,transparent);color:var(--color-text,#141413)}
|
|
32
|
+
.c-token-stream .ts-acts svg{width:16px;height:16px}
|
|
33
|
+
@keyframes ts-in{from{opacity:0;filter:blur(4px);transform:translateY(4px)}}
|
|
34
|
+
@keyframes ts-blink{50%{opacity:.15}}
|
|
35
|
+
@keyframes ts-shine{from{background-position:100% 0}to{background-position:-50% 0}}
|
|
36
|
+
@keyframes ts-spin{to{transform:rotate(1turn)}}
|
|
37
|
+
@media (prefers-reduced-motion:reduce){.c-token-stream *{animation:none!important;transition:none!important}}
|
|
38
|
+
</style>
|
|
39
|
+
</head>
|
|
40
|
+
<body>
|
|
41
|
+
<div class="stage-fit">
|
|
42
|
+
<div class="c-token-stream" data-comp="token-stream" role="status" aria-live="polite" data-text="周三上新:手擀|牛肉面,|汤底|熬了|八小时。|第一批|只做|五十碗,|建议|中午|前来。">
|
|
43
|
+
<div class="ts-who"><span class="ts-orb"></span><span>助手</span></div>
|
|
44
|
+
<div class="ts-think">在想…</div>
|
|
45
|
+
<div class="ts-out"></div>
|
|
46
|
+
<div class="ts-acts"><button aria-label="复制"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="8" width="12" height="12" rx="3"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/></svg></button><button aria-label="重写"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 12a8 8 0 1 1-2.4-5.7"/><path d="M20 4v5h-5"/></svg></button></div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<script data-comp>
|
|
50
|
+
/* 逐字回复逻辑:data-text 里用 | 分词;el.tsPlay() 重播。接真流式时,把每个新词 append 成 <span> 即可。 */
|
|
51
|
+
(() => {
|
|
52
|
+
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
53
|
+
document.querySelectorAll('.c-token-stream').forEach((el) => {
|
|
54
|
+
const out = el.querySelector('.ts-out'); const words = (el.dataset.text || '').split('|')
|
|
55
|
+
let timers = []
|
|
56
|
+
const later = (fn, ms) => timers.push(setTimeout(fn, ms))
|
|
57
|
+
const caret = () => { const c = document.createElement('i'); c.className = 'ts-caret'; return c }
|
|
58
|
+
el.tsPlay = (onDone) => {
|
|
59
|
+
timers.forEach(clearTimeout); timers = []; out.textContent = ''; el.classList.remove('done')
|
|
60
|
+
if (reduced) { out.textContent = words.join(''); el.classList.add('done'); onDone && onDone(); return }
|
|
61
|
+
el.classList.add('think')
|
|
62
|
+
later(() => {
|
|
63
|
+
el.classList.remove('think'); const c = caret(); out.append(c)
|
|
64
|
+
let t = 0
|
|
65
|
+
words.forEach((w, i) => { t += 70 + w.length * 26 + (/[,。!?]$/.test(words[i - 1] || '') ? 140 : 0); later(() => { const s = document.createElement('span'); s.textContent = w; out.insertBefore(s, c) }, t) })
|
|
66
|
+
later(() => { el.classList.add('done'); onDone && onDone() }, t + 380)
|
|
67
|
+
}, 1300)
|
|
68
|
+
}
|
|
69
|
+
el.tsStop = () => { timers.forEach(clearTimeout); timers = [] }
|
|
70
|
+
el.addEventListener('click', (e) => { if (!e.target.closest('.ts-acts')) el.tsPlay() })
|
|
71
|
+
})
|
|
72
|
+
})()
|
|
73
|
+
</script>
|
|
74
|
+
<script data-stage>
|
|
75
|
+
/* 演示舞台:每个组件都一样,只改 DEMO 那一段。组件按 340×212 设计,卡片小了整体等比缩小。 */
|
|
76
|
+
(() => {
|
|
77
|
+
const q = new URLSearchParams(location.search); const root = document.documentElement
|
|
78
|
+
root.dataset.theme = (q.get('theme') || (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) === 'dark' ? 'dark' : 'light'
|
|
79
|
+
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
80
|
+
const el = document.querySelector('.stage-fit > [data-comp]')
|
|
81
|
+
const fit = () => root.style.setProperty('--fit', Math.min(1, innerWidth / 340, innerHeight / 212).toFixed(3))
|
|
82
|
+
fit(); addEventListener('resize', fit)
|
|
83
|
+
let playing = !q.has('still'); let hovering = false; let timers = []
|
|
84
|
+
const later = (fn, ms) => timers.push(setTimeout(() => { if (playing && !hovering) fn() }, ms)) // 演示用的定时器:用户一来就全部作废
|
|
85
|
+
const stop = () => { timers.forEach(clearTimeout); timers = []; DEMO.stop() }
|
|
86
|
+
const go = (ms) => { stop(); if (playing && !hovering && !reduced) later(() => DEMO.loop(later), ms) }
|
|
87
|
+
// ===== 只改这一段 =====
|
|
88
|
+
const DEMO = {
|
|
89
|
+
settle () { el.tsStop(); el.querySelector('.ts-out').textContent = el.dataset.text.split('|').join(''); el.classList.remove('think'); el.classList.add('done') }, // 落定状态:整段写完
|
|
90
|
+
loop (later) { el.tsPlay(() => later(() => DEMO.loop(later), 2600)) }, // 写完停一会儿再重写
|
|
91
|
+
stop () {}, // 写到一半用户来了:让它写完,不再重来
|
|
92
|
+
}
|
|
93
|
+
// =====================
|
|
94
|
+
document.body.addEventListener('pointerenter', () => { hovering = true; stop() })
|
|
95
|
+
document.body.addEventListener('pointerleave', () => { hovering = false; go(1400) })
|
|
96
|
+
addEventListener('message', (e) => {
|
|
97
|
+
const d = e.data; if (!d || typeof d !== 'object') return
|
|
98
|
+
if (d.theme === 'light' || d.theme === 'dark') root.dataset.theme = d.theme
|
|
99
|
+
if (typeof d.ddpPlay === 'boolean') { playing = d.ddpPlay; root.classList.toggle('paused', !playing); if (playing) go(400); else stop() }
|
|
100
|
+
})
|
|
101
|
+
try { parent.postMessage({ ddpMotionReady: 1 }, '*') } catch (e) { /* 单独打开时没有外层 */ }
|
|
102
|
+
if (reduced || q.has('still')) DEMO.settle(); else go(600)
|
|
103
|
+
})()
|
|
104
|
+
</script>
|
|
105
|
+
</body>
|
|
106
|
+
</html>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title>语音光球</title>
|
|
7
|
+
<script type="application/json" id="meta">{"id":"voice-orb","zh":"语音光球","en":"Voice Orb","cat":"ai","desc":"柔和彩光在圆球内流动,点一下进入在听态并随音量鼓动起伏","desc_en":"Soft light swirls in the orb; tap to listen and it pulses with your voice","needs":"js","play":"press","hint":"点一下说话","hint_en":"Tap to talk","source":null,"prompt":"语音光球:108×108 液态玻璃圆球,内嵌高分屏 Canvas 渲染柔光云慢速旋流与球面高光。按下压扁蓄力(scale .91,100ms),松手弹簧回弹切入「在听」态:轮廓随模拟语流音量有机起伏、外圈扩散双层声波环,中心麦克风平滑切为五根跳动声柱。颜色读 --color-primary / --color-danger / --color-warning,减少动效定格在在听态。","prompt_en":"Voice orb: a 108×108 liquid-glass orb whose hi-DPI Canvas renders slowly swirling soft light and a sphere highlight. Press squashes it to .91 (100ms); release springs back into listening: the outline wobbles with simulated speech volume, two sound rings ripple out, and the mic morphs into five bouncing bars. Reads --color-primary / --color-danger / --color-warning; reduced motion freezes in the listening state."}</script>
|
|
8
|
+
<style data-stage>
|
|
9
|
+
:root{color-scheme:light;--color-bg:#efede7;--color-surface:#fff;--color-text:#141413;--color-muted:#76756f;--color-line:rgba(20,20,19,.1);--color-primary:#3b82f6;--color-danger:#ff375f;--color-warning:#ffb340;--color-success:#2eb85c;--font-sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","PingFang SC","Microsoft YaHei",system-ui,sans-serif}
|
|
10
|
+
:root[data-theme=dark]{color-scheme:dark;--color-bg:#17171a;--color-surface:#2c2c30;--color-text:#f5f5f4;--color-muted:#8e8d88;--color-line:rgba(255,255,255,.14);--color-primary:#60a5fa}
|
|
11
|
+
html,body{height:100%;margin:0}
|
|
12
|
+
body{display:grid;place-items:center;background:var(--color-bg);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;overflow:hidden;user-select:none;-webkit-user-select:none}
|
|
13
|
+
.paused *{animation-play-state:paused!important}
|
|
14
|
+
.stage-fit{position:absolute;left:50%;top:50%;width:max-content;display:grid;place-items:center;transform:translate(-50%,-50%) scale(var(--fit,1))}
|
|
15
|
+
</style>
|
|
16
|
+
<style data-comp>
|
|
17
|
+
/* 语音光球 · 液态柔光旋流 + 在听态音量鼓动与轮廓起伏。颜色读设计变量:--color-primary / --color-danger / --color-warning */
|
|
18
|
+
.c-voice-orb{--vo-s:108px;--vo-a:var(--color-primary,#3b82f6);--vo-sp:linear(0,.05,.18,.36,.56,.75,.91,1.03,1.1,1.12,1.11,1.08,1.04,1.01,.98,.97,.98,1,1.01,1);position:relative;width:168px;height:168px;display:grid;place-items:center}
|
|
19
|
+
.c-voice-orb .vo-a{position:absolute;width:134px;height:134px;border-radius:50%;background:radial-gradient(circle,color-mix(in srgb,var(--vo-a) 50%,transparent) 8%,color-mix(in srgb,#a855f7 32%,transparent) 42%,transparent 72%);filter:blur(18px);opacity:.44;transform:scale(.92);transition:opacity .45s,transform .6s var(--vo-sp);pointer-events:none}
|
|
20
|
+
.c-voice-orb.on .vo-a{opacity:.86;transform:scale(1.12);animation:vo-br 1.65s ease-in-out infinite}
|
|
21
|
+
.c-voice-orb .vo-w{position:absolute;width:var(--vo-s);height:var(--vo-s);border-radius:50%;border:1.5px solid color-mix(in srgb,var(--vo-a) 62%,transparent);opacity:0;transform:scale(.95);pointer-events:none}
|
|
22
|
+
.c-voice-orb.on .vo-w{animation:vo-rp 2s cubic-bezier(.16,.76,.32,1) infinite}
|
|
23
|
+
.c-voice-orb.on .vo-w.w2{animation-delay:1s}
|
|
24
|
+
.c-voice-orb .vo-b{position:relative;width:var(--vo-s);height:var(--vo-s);padding:0;border:0;border-radius:50%;background:0;display:grid;place-items:center;cursor:pointer;outline:none;transition:transform .62s var(--vo-sp);-webkit-tap-highlight-color:transparent;filter:drop-shadow(0 12px 22px color-mix(in srgb,var(--vo-a) 32%,rgba(0,0,0,.22)))}
|
|
25
|
+
.c-voice-orb .vo-b:hover{transform:scale(1.035)}
|
|
26
|
+
.c-voice-orb .vo-b:active,.c-voice-orb.pr .vo-b{transform:scale(.91);transition:transform .1s cubic-bezier(.3,0,.5,1)}
|
|
27
|
+
.c-voice-orb .vo-b:focus-visible{outline:2px solid var(--vo-a);outline-offset:6px}
|
|
28
|
+
.c-voice-orb .vo-cv{position:absolute;left:50%;top:50%;width:154px;height:154px;margin:-77px 0 0 -77px;pointer-events:none}
|
|
29
|
+
.c-voice-orb .vo-g{position:relative;z-index:2;width:34px;height:34px;display:grid;place-items:center;pointer-events:none;color:#fff;filter:drop-shadow(0 2px 6px rgba(15,23,42,.26))}
|
|
30
|
+
.c-voice-orb .vo-m{position:absolute;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;transition:opacity .25s,transform .45s var(--vo-sp)}
|
|
31
|
+
.c-voice-orb.on .vo-m{opacity:0;transform:scale(.55)}
|
|
32
|
+
.c-voice-orb .vo-s{position:absolute;display:flex;align-items:center;gap:3.5px;height:26px;opacity:0;transform:scale(.6);transition:opacity .25s,transform .48s var(--vo-sp)}
|
|
33
|
+
.c-voice-orb.on .vo-s{opacity:1;transform:scale(1)}
|
|
34
|
+
.c-voice-orb .vo-s i{display:block;width:3.2px;height:20px;border-radius:99px;background:#fff;transform:scaleY(.35)}
|
|
35
|
+
.c-voice-orb .vo-s i:first-child,.c-voice-orb .vo-s i:last-child{height:13px}
|
|
36
|
+
.c-voice-orb .vo-s i:nth-child(3){height:26px}
|
|
37
|
+
.c-voice-orb.on .vo-s i{animation:vo-bar var(--d,.64s) ease-in-out var(--dl,0s) infinite}
|
|
38
|
+
@keyframes vo-br{0%,100%{transform:scale(1.06);opacity:.68}50%{transform:scale(1.22);opacity:.94}}
|
|
39
|
+
@keyframes vo-rp{0%{opacity:.66;transform:scale(.96)}100%{opacity:0;transform:scale(1.52)}}
|
|
40
|
+
@keyframes vo-bar{0%,100%{transform:scaleY(.32)}45%{transform:scaleY(1)}72%{transform:scaleY(.52)}}
|
|
41
|
+
@media (prefers-reduced-motion:reduce){.c-voice-orb *{animation:none!important;transition-duration:.01ms!important}.c-voice-orb.on .vo-s i{transform:scaleY(.84)}.c-voice-orb.on .vo-s i:first-child,.c-voice-orb.on .vo-s i:last-child{transform:scaleY(.62)}.c-voice-orb.on .vo-s i:nth-child(3){transform:scaleY(1)}}
|
|
42
|
+
</style>
|
|
43
|
+
</head>
|
|
44
|
+
<body>
|
|
45
|
+
<div class="stage-fit">
|
|
46
|
+
<div class="c-voice-orb" data-comp="voice-orb">
|
|
47
|
+
<span class="vo-a" aria-hidden="true"></span>
|
|
48
|
+
<span class="vo-w" aria-hidden="true"></span>
|
|
49
|
+
<span class="vo-w w2" aria-hidden="true"></span>
|
|
50
|
+
<button class="vo-b" type="button" aria-label="开始语音" aria-pressed="false">
|
|
51
|
+
<canvas class="vo-cv" width="308" height="308" aria-hidden="true"></canvas>
|
|
52
|
+
<span class="vo-g" aria-hidden="true">
|
|
53
|
+
<svg class="vo-m" viewBox="0 0 24 24"><rect x="9" y="3.5" width="6" height="10.5" rx="3"/><path d="M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v3M9 21h6"/></svg>
|
|
54
|
+
<span class="vo-s"><i style="--d:.78s;--dl:-.52s"></i><i style="--d:.62s;--dl:-.2s"></i><i style="--d:.56s"></i><i style="--d:.66s;--dl:-.34s"></i><i style="--d:.8s;--dl:-.46s"></i></span>
|
|
55
|
+
</span>
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
<script data-comp>
|
|
60
|
+
/* 语音光球逻辑:Canvas 柔光旋流 + 球面高光 + 弹簧模拟语流起伏。 */
|
|
61
|
+
(() => {
|
|
62
|
+
const rm = matchMedia('(prefers-reduced-motion: reduce)').matches, T = Math.PI * 2
|
|
63
|
+
document.querySelectorAll('.c-voice-orb').forEach((el) => {
|
|
64
|
+
const btn = el.querySelector('.vo-b'), cv = el.querySelector('.vo-cv'), ctx = cv.getContext('2d')
|
|
65
|
+
const W = cv.width, C = W / 2, R = 104
|
|
66
|
+
let live = false, t = 1.4, eL = 0, ev = 0, vL = 0, vv = 0, last = 0
|
|
67
|
+
const rg = (x, y, r0, X, Y, r1, st) => { const g = ctx.createRadialGradient(x, y, r0, X, Y, r1); for (const [p, c] of st) g.addColorStop(p, c); return g }
|
|
68
|
+
const path = (ts, e, v) => {
|
|
69
|
+
const rM = R * (1 + v * .075), wob = .006 + e * (.034 + v * .048)
|
|
70
|
+
ctx.beginPath()
|
|
71
|
+
for (let i = 0; i <= 64; i++) {
|
|
72
|
+
const a = i / 64 * T, w = Math.sin(a * 3 + ts * 2.6) * .5 + Math.cos(a * 4 - ts * 3.3) * .32 + Math.sin(a * 2 + ts * 1.8 + 1.2) * .36
|
|
73
|
+
const r = rM * (1 + wob * w), x = C + Math.cos(a) * r, y = C + Math.sin(a) * r
|
|
74
|
+
i ? ctx.lineTo(x, y) : ctx.moveTo(x, y)
|
|
75
|
+
}
|
|
76
|
+
ctx.closePath()
|
|
77
|
+
}
|
|
78
|
+
const draw = (ts, e, v) => {
|
|
79
|
+
const cs = getComputedStyle(el), pv = (k, d) => cs.getPropertyValue(k).trim() || d
|
|
80
|
+
const c1 = pv('--color-primary', '#3b82f6'), c4 = pv('--color-danger', '#ff375f'), c5 = pv('--color-warning', '#ffb340')
|
|
81
|
+
ctx.clearRect(0, 0, W, W); ctx.save(); path(ts, e, v); ctx.clip()
|
|
82
|
+
ctx.fillStyle = rg(C - 30, C - 34, 14, C, C, R * 1.2, [[0, '#72c2ff'], [.52, '#3b52e8'], [1, '#1d1c58']])
|
|
83
|
+
ctx.fillRect(0, 0, W, W)
|
|
84
|
+
const sp = .72 + e * 1.25
|
|
85
|
+
ctx.globalCompositeOperation = 'screen'
|
|
86
|
+
for (const [ang, d, rad, col, al] of [[ts * .9 * sp, 38 + v * 12, 86, '#38bdf8', .94], [-ts * .76 * sp + 2.1, 42 + v * 10, 90, '#b56bff', .92], [ts * 1.08 * sp + 4.2, 36 + v * 14, 78, c4, .82], [-ts * .64 * sp + 5.1, 32 + v * 9, 72, c5, .52 + e * .24], [ts * .52 * sp + 1, 18, 82, c1, .76]]) {
|
|
87
|
+
const bx = C + Math.cos(ang) * d, by = C + Math.sin(ang * 1.15) * d
|
|
88
|
+
ctx.globalAlpha = al; ctx.fillStyle = rg(bx, by, 4, bx, by, rad, [[0, col], [1, '#0000']])
|
|
89
|
+
ctx.beginPath(); ctx.arc(bx, by, rad, 0, T); ctx.fill()
|
|
90
|
+
}
|
|
91
|
+
ctx.globalAlpha = .26 + v * .34
|
|
92
|
+
ctx.fillStyle = rg(C, C - 6, 2, C, C, 64 + v * 22, [[0, '#fff'], [1, '#fff0']]); ctx.fillRect(0, 0, W, W)
|
|
93
|
+
ctx.globalCompositeOperation = 'source-over'; ctx.globalAlpha = 1
|
|
94
|
+
ctx.fillStyle = rg(C - 34, C - 48, 4, C - 24, C - 32, 84, [[0, '#fff8'], [.55, '#fff1'], [1, '#fff0']]); ctx.fillRect(0, 0, W, W)
|
|
95
|
+
ctx.fillStyle = rg(C, C - 12, R * .55, C, C, R * 1.12, [[0, '#0f172a00'], [.82, '#0f172a1a'], [1, '#0f172a5c']]); ctx.fillRect(0, 0, W, W); ctx.restore()
|
|
96
|
+
ctx.save(); path(ts, e, v); ctx.strokeStyle = '#fff6'; ctx.lineWidth = 2.2; ctx.stroke(); ctx.restore()
|
|
97
|
+
}
|
|
98
|
+
const tick = (now) => {
|
|
99
|
+
if (document.documentElement.classList.contains('paused')) { last = now; return requestAnimationFrame(tick) }
|
|
100
|
+
const dt = Math.min(.032, (now - (last || now)) / 1000) || .016; last = now; t += dt
|
|
101
|
+
const tE = live ? 1 : 0, sp = live ? Math.max(0, .42 + .34 * Math.sin(t * 7.2) + .24 * Math.sin(t * 13.5 + 1.1) + .16 * Math.cos(t * 4.3)) : 0
|
|
102
|
+
for (let i = 0, n = Math.ceil(dt / .004), h = dt / n; i < n; i++) { ev += (-120 * (eL - tE) - 16 * ev) * h; eL += ev * h; vv += (-180 * (vL - sp) - 18 * vv) * h; vL += vv * h }
|
|
103
|
+
draw(t, Math.max(0, eL), Math.max(0, vL)); requestAnimationFrame(tick)
|
|
104
|
+
}
|
|
105
|
+
el.voSet = (on) => { live = !!on; el.classList.toggle('on', live); btn.setAttribute('aria-pressed', live); btn.setAttribute('aria-label', live ? '在听,点一下停' : '开始语音'); if (rm) draw(2.2, live ? 1 : 0, live ? .55 : 0) }
|
|
106
|
+
btn.addEventListener('click', () => el.voSet(!live))
|
|
107
|
+
if (rm) draw(2.2, 1, .55); else requestAnimationFrame(tick)
|
|
108
|
+
})
|
|
109
|
+
})()
|
|
110
|
+
</script>
|
|
111
|
+
<script data-stage>
|
|
112
|
+
/* 演示舞台:每个组件都一样,只改 DEMO 那一段。组件按 340×212 设计,卡片小了整体等比缩小。 */
|
|
113
|
+
(() => {
|
|
114
|
+
const q = new URLSearchParams(location.search); const root = document.documentElement
|
|
115
|
+
root.dataset.theme = (q.get('theme') || (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')) === 'dark' ? 'dark' : 'light'
|
|
116
|
+
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
117
|
+
const el = document.querySelector('.stage-fit > [data-comp]')
|
|
118
|
+
const fit = () => root.style.setProperty('--fit', Math.min(1, innerWidth / 340, innerHeight / 212).toFixed(3))
|
|
119
|
+
fit(); addEventListener('resize', fit)
|
|
120
|
+
let playing = !q.has('still'); let hovering = false; let timers = []
|
|
121
|
+
const later = (fn, ms) => timers.push(setTimeout(() => { if (playing && !hovering) fn() }, ms)) // 演示用的定时器:用户一来就全部作废
|
|
122
|
+
const stop = () => { timers.forEach(clearTimeout); timers = []; DEMO.stop() }
|
|
123
|
+
const go = (ms) => { stop(); if (playing && !hovering && !reduced) later(() => DEMO.loop(later), ms) }
|
|
124
|
+
// ===== 只改这一段 =====
|
|
125
|
+
const press = (later, on, then) => { el.classList.add('pr'); later(() => { el.classList.remove('pr'); el.voSet(on); then() }, 130) }
|
|
126
|
+
const DEMO = {
|
|
127
|
+
settle () { el.voSet(true) },
|
|
128
|
+
loop (later) { press(later, true, () => later(() => press(later, false, () => later(() => DEMO.loop(later), 1500)), 2150)) },
|
|
129
|
+
stop () { el.classList.remove('pr') },
|
|
130
|
+
}
|
|
131
|
+
// =====================
|
|
132
|
+
document.body.addEventListener('pointerenter', () => { hovering = true; stop() })
|
|
133
|
+
document.body.addEventListener('pointerleave', () => { hovering = false; go(1400) })
|
|
134
|
+
addEventListener('message', (e) => {
|
|
135
|
+
const d = e.data; if (!d || typeof d !== 'object') return
|
|
136
|
+
if (d.theme === 'light' || d.theme === 'dark') root.dataset.theme = d.theme
|
|
137
|
+
if (typeof d.ddpPlay === 'boolean') { playing = d.ddpPlay; root.classList.toggle('paused', !playing); if (playing) go(400); else stop() }
|
|
138
|
+
})
|
|
139
|
+
try { parent.postMessage({ ddpMotionReady: 1 }, '*') } catch (e) { /* 单独打开时没有外层 */ }
|
|
140
|
+
if (reduced || q.has('still')) DEMO.settle(); else go(600)
|
|
141
|
+
})()
|
|
142
|
+
</script>
|
|
143
|
+
</body>
|
|
144
|
+
</html>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|