Claude Code + Opus5.5 MAX | 2D鹈鹕
用时52分钟,思考了40分钟才动手

pelican-bicycle.html
鹈鹕骑单车
:root {
color-scheme: light;
--page: #f4b98c;
/* sky & sea */
--sky-1: #86c9c4; --sky-2: #f7e0b8; --sky-3: #f5b086;
--sun: #ef6a45; --sun-glow: #ffe2b0;
--moon: #f1ebcf; --moon-crater: #dcd2ae; --moon-glow: #9aa6dc; --star: #fff6d6;
--cloud: #fff5e4; --cloud-shade: #f3cfae;
--far-1: #eab39b; --far-2: #d99680;
--lh: #fbf2e4; --lh-stripe: #d9483b; --lh-room: #f6d27a;
--sea-1: #8fcfc5; --sea-2: #2f9096; --sea-3: #1f6f78;
--wave: #c4f0e4; --glitter: #fff1c6; --foam: #fffaf0;
/* shore & road */
--sand: #f0cb93; --sand-shade: #ddb077; --wet-sand: #cfa36b;
--trunk: #8f6446; --trunk-ring: #6f4a33; --leaf: #3e8a58; --leaf-2: #2c6b43; --coconut: #6b4a2e;
--umb-a: #e8513d; --umb-b: #fff4e4; --towel: #3f7fd0;
--grass: #86a34c; --grass-dark: #5f7f36; --flower-a: #f8d65a; --flower-b: #f28a7a;
--fence: #fbf4e8; --fence-shade: #d9c8ae;
--lamp-post: #3a4150; --lamp-bulb: #e9e2cf; --lamp-light: #fff0b3;
--road: #3e414d; --road-edge: #2b2d37; --road-line: #f6e8c6; --road-speck: #52566a;
--verge-1: #8aa957; --verge-2: #62823a;
--shadow: #1b1f2a; --wind: #ffffff; --ink: #1c2433;
/* pelican */
--bird: #fcf8f0; --bird-shade: #e6ddcb; --bird-line: #b8ab93; --bird-black: #262c38; --crest: #f7e3a1;
--bill: #f7a93c; --bill-shade: #e08a2c; --bill-tip: #e35a3c; --pouch: #f8bb5f; --pouch-shade: #e99a45;
--leg: #f59b3d; --leg-shade: #cf742b; --eye-ring: #f5d15e; --iris: #3a2a22;
/* bicycle */
--frame: #2f5fc4; --frame-hi: #6b93ea; --frame-shade: #20459a;
--fender: #f3e6cd; --metal: #cdd2da; --metal-shade: #8e96a3; --tire: #23262e; --tire-hi: #4a4f5c;
--saddle: #6d3f28; --grip: #7b4a2f; --basket: #d9a45c; --basket-shade: #a9763f;
--chain: #555b68; --lamp-lens: #fff7d8;
--scarf-a: #e2483b; --scarf-b: #fff1d8; --flag: #f4b937; --fish: #86aec6; --fish-shade: #5c88a6;
--day: 1; --night: 0;
/* interface */
--ui-ink: #1c2433; --ui-sub: #43506a;
--shell: #22262f; --shell-hi: #3a404d; --btn: #2d323d; --btn-hi: #3a404d; --btn-ink: #efe8d8;
--lcd: #c9d4b5; --lcd-ink: #1c261c; --lcd-ghost: rgba(28, 38, 28, .08); --lcd-glow: rgba(0, 0, 0, 0);
--accent: #ef6a45; --focus: #f4b937;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
color-scheme: dark;
--page: #070d24;
--sky-1: #050a1f; --sky-2: #121c47; --sky-3: #33356a;
--cloud: #27305e; --cloud-shade: #1a2149;
--far-1: #1f2750; --far-2: #182044;
--lh: #b9bdd4; --lh-stripe: #7d3b4b; --lh-room: #ffe9a3;
--sea-1: #1e335e; --sea-2: #11284a; --sea-3: #0a1c36;
--wave: #3c6497; --glitter: #eeeacb; --foam: #8fa2cc;
--sand: #3b3c5e; --sand-shade: #303153; --wet-sand: #2a2b4a;
--trunk: #2b2a40; --trunk-ring: #1f1e31; --leaf: #1b3540; --leaf-2: #142a33; --coconut: #1f1e31;
--umb-a: #6f3246; --umb-b: #9ea1c2; --towel: #2c4677;
--grass: #2a473f; --grass-dark: #1d3530; --flower-a: #a9a46e; --flower-b: #94677a;
--fence: #a4a9c6; --fence-shade: #6d7393;
--lamp-post: #0f131d; --lamp-bulb: #fff4c2; --lamp-light: #ffe9a6;
--road: #1d202b; --road-edge: #13151d; --road-line: #aeab95; --road-speck: #272b39;
--verge-1: #203630; --verge-2: #142520;
--shadow: #000000; --wind: #c9d6ff; --ink: #0b1020;
--bird: #e4e7f1; --bird-shade: #b6bcd2; --bird-line: #7c83a3; --bird-black: #121624; --crest: #d9cf9c;
--bill: #e39c47; --bill-shade: #bf7a33; --bill-tip: #c4533f; --pouch: #e2a55a; --pouch-shade: #bf8140;
--leg: #dc8c40; --leg-shade: #a8642f; --eye-ring: #d8bd62; --iris: #20160f;
--frame: #3a66cc; --frame-hi: #7196e6; --frame-shade: #24418c;
--fender: #a6a9c0; --metal: #aeb4c4; --metal-shade: #6a7184; --tire: #0f1117; --tire-hi: #2c303c;
--saddle: #4c2c1e; --grip: #5a3624; --basket: #a47845; --basket-shade: #74532f;
--chain: #3a3f4c; --lamp-lens: #fffbe6;
--scarf-a: #cc4338; --scarf-b: #d6cfc0; --flag: #d6a235; --fish: #8199bb; --fish-shade: #5b7395;
--day: 0; --night: 1;
--ui-ink: #f1ebdc; --ui-sub: #b4bbd6;
--shell: #11141b; --shell-hi: #262b36; --btn: #1e232d; --btn-hi: #2b313d; --btn-ink: #efe8d8;
--lcd: #86e3cb; --lcd-ink: #0a2b25; --lcd-ghost: rgba(10, 43, 37, .10); --lcd-glow: rgba(134, 227, 203, .35);
--accent: #f28a5f;
}
}
:root[data-theme="dark"] {
color-scheme: dark;
--page: #070d24;
--sky-1: #050a1f; --sky-2: #121c47; --sky-3: #33356a;
--cloud: #27305e; --cloud-shade: #1a2149;
--far-1: #1f2750; --far-2: #182044;
--lh: #b9bdd4; --lh-stripe: #7d3b4b; --lh-room: #ffe9a3;
--sea-1: #1e335e; --sea-2: #11284a; --sea-3: #0a1c36;
--wave: #3c6497; --glitter: #eeeacb; --foam: #8fa2cc;
--sand: #3b3c5e; --sand-shade: #303153; --wet-sand: #2a2b4a;
--trunk: #2b2a40; --trunk-ring: #1f1e31; --leaf: #1b3540; --leaf-2: #142a33; --coconut: #1f1e31;
--umb-a: #6f3246; --umb-b: #9ea1c2; --towel: #2c4677;
--grass: #2a473f; --grass-dark: #1d3530; --flower-a: #a9a46e; --flower-b: #94677a;
--fence: #a4a9c6; --fence-shade: #6d7393;
--lamp-post: #0f131d; --lamp-bulb: #fff4c2; --lamp-light: #ffe9a6;
--road: #1d202b; --road-edge: #13151d; --road-line: #aeab95; --road-speck: #272b39;
--verge-1: #203630; --verge-2: #142520;
--shadow: #000000; --wind: #c9d6ff; --ink: #0b1020;
--bird: #e4e7f1; --bird-shade: #b6bcd2; --bird-line: #7c83a3; --bird-black: #121624; --crest: #d9cf9c;
--bill: #e39c47; --bill-shade: #bf7a33; --bill-tip: #c4533f; --pouch: #e2a55a; --pouch-shade: #bf8140;
--leg: #dc8c40; --leg-shade: #a8642f; --eye-ring: #d8bd62; --iris: #20160f;
--frame: #3a66cc; --frame-hi: #7196e6; --frame-shade: #24418c;
--fender: #a6a9c0; --metal: #aeb4c4; --metal-shade: #6a7184; --tire: #0f1117; --tire-hi: #2c303c;
--saddle: #4c2c1e; --grip: #5a3624; --basket: #a47845; --basket-shade: #74532f;
--chain: #3a3f4c; --lamp-lens: #fffbe6;
--scarf-a: #cc4338; --scarf-b: #d6cfc0; --flag: #d6a235; --fish: #8199bb; --fish-shade: #5b7395;
--day: 0; --night: 1;
--ui-ink: #f1ebdc; --ui-sub: #b4bbd6;
--shell: #11141b; --shell-hi: #262b36; --btn: #1e232d; --btn-hi: #2b313d; --btn-ink: #efe8d8;
--lcd: #86e3cb; --lcd-ink: #0a2b25; --lcd-ghost: rgba(10, 43, 37, .10); --lcd-glow: rgba(134, 227, 203, .35);
--accent: #f28a5f;
}
html, body { height: 100%; }
body {
margin: 0; overflow: hidden; background: var(–page); color: var(–ui-ink);
font-family: “Noto Sans SC”, “PingFang SC”, “Microsoft YaHei”, sans-serif;
-webkit-font-smoothing: antialiased;
}
.stage { position: fixed; inset: 0; overflow: hidden; background: var(–page); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#scene * { transition: fill .9s ease, stroke .9s ease, opacity .9s ease; }
#scene stop { transition: stop-color .9s ease; }
#scene .nt, #scene .nt * { transition: none; }
.day-only { opacity: var(–day); }
.night-only { opacity: var(–night); }
.glint { animation: glint 2.4s ease-in-out infinite; }
.twinkle { animation: twinkle 3.2s@keyframesease-in-out infinite; }
@keyframeskeyframes glint { 0%, 100% { opacit@keyframes50: .15; }@keyframes50% @keyframes opacity: .95; } }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.paused .glint, .paused .twinkle { animation-play-state: paused; }
/* paper grain over the whole scene */
.grain {
position: fixed; inset: 0; pointer-events: none; opacity: .5;
background-image: url(“data:image/svg+xml;utf8,”);
}
/* title lockup */
.lockup {
position: fixed; left: max(16px, 3.2vw); top: calc(max(16px, 3.4vh) + env(safe-area-inset-top, 0px));
max-width: min(480px, calc(100% - 32px)); pointer-events: none;
}
.eyebrow {
margin: 0 0 10px; font: 600 12px/1 “Chakra Petch”, “Noto Sans SC”, sans-serif;
letter-spacing: .24em; text-transform: uppercase; color: var(–ui-sub); transition: color .9s;
}
.lockup h1 {
margin: 0; font-family: “ZCOOL QingKe HuangYou”, “Noto Sans SC”, sans-serif; font-weight: 400;
font-size: clamp(44px, 6vw, 84px); line-height: .92; letter-spacing: .03em;
color: var(–ui-ink); text-wrap: balance; transition: color .9s;
}
.lockup h1 em { font-style: normal; color: var(–accent); transition: color .9s; }
.sub {
margin: 14px 0 0; font-size: 15px; line-height: 1.65; color: var(–ui-sub); max-width: 24em;
transition: color .9s;
}
/* handlebar computer */
.hud {
position: fixed; left: 50%; transform: translateX(-50%);
bottom: calc(14px + env(safe-area-inset-bottom, 0px));
width: min(610px, calc(100% - 32px));
}
.computer {
display: grid; grid-template-columns: 236px 1fr; gap: 14px; align-items: stretch;
padding: 12px; border-radius: 24px; color: var(–btn-ink);
background: linear-gradient(180deg, var(–shell-hi), var(–shell) 46%);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 18px 36px -14px rgba(10, 14, 24, .55);
}
.lcd {
border-radius: 12px; padding: 6px 8px; background: var(–lcd);
box-shadow: inset 0 2px 7px rgba(0, 0, 0, .38), 0 0 26px var(–lcd-glow);
transition: background-color .9s, box-shadow .9s;
}
.lcd svg { display: block; width: 100%; height: auto; }
.lcd .seg-off { fill: var(–lcd-ghost); }
.lcd .seg-on { fill: var(–lcd-ink); }
.lcd text { fill: var(–lcd-ink); font: 600 8.5px “Chakra Petch”, sans-serif; letter-spacing: .08em; }
.controls { display: grid; gap: 10px; align-content: center; }
.gearbox { display: flex; align-items: center; gap: 12px; }
.ctl-label {
font: 600 11px/1 “Chakra Petch”, “Noto Sans SC”, sans-serif; letter-spacing: .14em;
color: #aab1c2; white-space: nowrap;
}
.gears { display: flex; align-items: flex-end; gap: 5px; flex: 1; }
.gear {
flex: 1; min-width: 0; height: 42px; padding: 0 0 3px; border: 0; border-radius: 8px;
background: transparent; color: #8a92a5; cursor: pointer;
display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
font: 600 11px/1 “Chakra Petch”, sans-serif;
}
.gear i {
display: block; width: 62%; max-width: 16px; height: var(–h); border-radius: 3px;
background: #454c5b; transition: background-color .25s, transform .25s;
}
.gear:hover i { background: #5d6577; }
.gear[aria-checked=“true”] { color: var(–btn-ink); }
.gear[aria-checked=“true”] i { background: var(–accent); transform: scaleY(1.08); transform-origin: bottom; }
.btns { display: flex; gap: 8px; }
.btn {
flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
height: 40px; padding: 0 14px; border: 0; border-radius: 12px; cursor: pointer;
background: var(–btn); color: var(–btn-ink);
font: 500 14px/1 “Noto Sans SC”, “PingFang SC”, “Microsoft YaHei”, sans-serif;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 0 rgba(0, 0, 0, .35);
}
.btn:hover { background: var(–btn-hi); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.btn svg { width: 16px; height: 16px; flex: none; }
.gear:focus-visible, .btn:focus-visible { outline: 2px solid var(–focus); outline-offset: 2px; }
.hint {
margin: 8px 0 0; text-align: center; font-size: 12px; color: var(–ui-sub);
letter-spacing: .04em; transition: color .9s;
}
.hint kbd {
font: 600 11px/1 “Chakra Petch”, sans-serif; padding:@mediaborder2px 5px; border-radius: 4px;@mediaborder: 1px s@medialid currentColor; opacity: .85@media
}
@medi@media (hover: none) { .hint { display: none; } }
@media (max-width: 560px) {
.computer { grid-template-columns: 1fr; gap: 10px; padding: 10px; border-radius: 20px; }
.lcd { max-width: 300px; width: 100%; jus@mediaify-self: center; }
.sub { font-size: 14px; }
}
@media (max-height: 460px) and (orientation: landscape) {
.lockup h1 { font-size: 40px; }
.sub, .hint { display: none; }
.computer { padding: 8px; }
}
<rect x="-4000" y="-4000" width="8000" height="3800" fill="url(#gSky)"/>
<g id="stars" class="night-only"></g>
<g id="sun" class="day-only">
<circle cx="-120" cy="-222" r="330" fill="url(#gSunGlow)"/>
<circle cx="-120" cy="-222" r="165" style="fill:var(--sun)"/>
</g>
<g id="moon" class="night-only">
<circle cx="-120" cy="-300" r="280" fill="url(#gMoonGlow)"/>
<circle cx="-120" cy="-300" r="92" style="fill:var(--moon)"/>
<g style="fill:var(--moon-crater)">
<circle cx="-150" cy="-330" r="17"/><circle cx="-92" cy="-352" r="10"/>
<circle cx="-88" cy="-282" r="21"/><circle cx="-150" cy="-262" r="9"/><circle cx="-122" cy="-300" r="6"/>
</g>
</g>
<g id="lClouds"></g>
<g id="gulls" class="day-only"></g>
<g id="lFar"></g>
<rect x="-4000" y="-205.5" width="8000" height="114" fill="url(#gSea)"/>
<g id="glitter"></g>
<g id="lWaveFar"></g>
<g id="lWaveNear"></g>
<g id="boat"></g>
<rect x="-4000" y="-92" width="8000" height="67" fill="url(#gSand)"/>
<g id="lFoam"></g>
<g id="lBeach"></g>
<g id="lDune"></g>
<g id="lFence"></g>
<rect x="-4000" y="-26" width="8000" height="72" style="fill:var(--road)"/>
<rect x="-4000" y="-27" width="8000" height="5" style="fill:var(--road-edge)"/>
<g id="lRoad"></g>
<g id="lPools" class="night-only"></g>
<rect x="-4000" y="33" width="8000" height="3.5" style="fill:var(--road-line)"/>
<rect x="-4000" y="44" width="8000" height="8" style="fill:var(--road-edge)"/>
<rect x="-4000" y="51" width="8000" height="4000" fill="url(#gVerge)"/>
<g id="lVerge"></g>
<g id="beam" class="night-only">
<path d="M178,-191 L940,-70 L940,44 L560,44 L178,-181 Z" fill="url(#gBeam)"/>
<ellipse cx="560" cy="12" rx="300" ry="24" fill="url(#gPool)"/>
</g>
<g id="rider">
<defs>
<path id="bodyShape" d="M40,-250 C42,-268 36,-280 24,-286 C0,-298 -40,-298 -62,-288 C-84,-278 -104,-262 -122,-248 L-142,-240 L-135,-232 L-142,-226 C-122,-222 -104,-214 -84,-206 C-62,-194 -30,-186 -6,-192 C18,-198 36,-222 40,-250 Z"/>
<clipPath id="clipBody"><use href="#bodyShape"/></clipPath>
</defs>
<ellipse cx="0" cy="1" rx="178" ry="9" fill="url(#gShadow)"/>
<!-- safety flag on the rear axle -->
<path id="flagPole" d="M-126,-92 Q-146,-210 -168,-330" fill="none" stroke-width="2.4" stroke-linecap="round" style="stroke:var(--metal-shade)"/>
<path id="flagCloth" class="nt" style="fill:var(--flag)"/>
<!-- far side: leg, crank, pedal -->
<g id="legFar">
<path id="shinF" fill="none" stroke-width="8" stroke-linecap="round" style="stroke:var(--leg-shade)"/>
<g id="footF"><path class="foot" style="fill:var(--leg-shade)"/></g>
<path id="thighF" stroke-width="1.4" style="fill:var(--bird-shade);stroke:var(--bird-line)"/>
</g>
<g transform="translate(-16,-70)"><g id="crankFar"><rect x="-4" y="-4" width="38" height="8" rx="4" transform="rotate(180)" style="fill:var(--metal-shade)"/></g></g>
<g id="pedalF"><rect x="-10" y="-3" width="20" height="6" rx="2" style="fill:var(--tire)"/></g>
<!-- wheels (spokes built in script) -->
<g transform="translate(-122,-80)"><g id="wheelR"></g></g>
<g transform="translate(122,-80)"><g id="wheelF"></g></g>
<!-- mudguards -->
<path d="M-207.67,-87.5 A86,86 0 0 1 -51.55,-129.33" fill="none" stroke-width="6" stroke-linecap="round" style="stroke:var(--fender)"/>
<path d="M72.67,-150.45 A86,86 0 0 1 206.69,-65.07" fill="none" stroke-width="6" stroke-linecap="round" style="stroke:var(--fender)"/>
<rect x="-212" y="-104" width="6" height="11" rx="2" style="fill:var(--bill-tip)"/>
<!-- frame -->
<g fill="none" stroke-linecap="round" stroke-linejoin="round">
<path d="M-16,-70 L-122,-80" stroke-width="6" style="stroke:var(--frame)"/>
<path d="M-45,-158 L-122,-80" stroke-width="5.5" style="stroke:var(--frame)"/>
<path d="M-16,-70 L-46.9,-165.1" stroke-width="8.5" style="stroke:var(--frame)"/>
<path d="M-16,-70 L96.8,-143.8" stroke-width="9.5" style="stroke:var(--frame)"/>
<path d="M-45,-162.5 L91.8,-159" stroke-width="8" style="stroke:var(--frame)"/>
<path d="M98,-140 L111.9,-97.2 Q115,-87.7 122,-80" stroke-width="6" style="stroke:var(--frame)"/>
<path d="M98.5,-138.5 L89.5,-166.2" stroke-width="12" style="stroke:var(--frame-shade)"/>
<path d="M-36,-164.6 L84,-161.6" stroke-width="2" style="stroke:var(--frame-hi)"/>
<path d="M-0.9,-83.45 L82.8,-138.15" stroke-width="2.2" style="stroke:var(--frame-hi)"/>
<path d="M-26.1,-93 L-43.1,-145.3" stroke-width="2" style="stroke:var(--frame-hi)"/>
<path d="M113,-174 L120.5,-84 M157,-174 L123.5,-84" stroke-width="2" style="stroke:var(--metal-shade)"/>
</g>
<circle cx="-16" cy="-70" r="10" style="fill:var(--frame-shade)"/>
<circle cx="-45.5" cy="-162.5" r="5.5" style="fill:var(--frame-shade)"/>
<ellipse cx="95.2" cy="-152.5" rx="2.6" ry="5.5" transform="rotate(18 95.2 -152.5)" style="fill:var(--fender)"/>
<!-- seatpost + sprung leather saddle -->
<path d="M-46.9,-165.1 L-53.7,-186" stroke-width="5" stroke-linecap="round" style="stroke:var(--metal)"/>
<path d="M-76,-191 l3,2 l-4,2 l4,2 l-4,2 M-66,-191 l3,2 l-4,2 l4,2 l-4,2" fill="none" stroke-width="1.6" style="stroke:var(--metal-shade)"/>
<path d="M-84,-197 C-84,-206 -70,-207 -56,-205 C-44,-203 -34,-199 -26,-196 C-30,-192 -44,-191 -58,-192 C-72,-192 -84,-191 -84,-197 Z" style="fill:var(--saddle)"/>
<!-- drivetrain -->
<circle cx="-122" cy="-80" r="9.5" style="fill:var(--metal-shade)"/>
<g transform="translate(-16,-70)"><g id="ring">
<circle r="23.4" fill="none" stroke-width="3.2" stroke-dasharray="2.3 2.3" style="stroke:var(--metal-shade)"/>
<circle r="21.4" fill="none" stroke-width="3" style="stroke:var(--metal)"/>
<path d="M0,0 L0,-19 M0,0 L18.1,-5.9 M0,0 L11.2,15.4 M0,0 L-11.2,15.4 M0,0 L-18.1,-5.9" fill="none" stroke-width="3.4" stroke-linecap="round" style="stroke:var(--metal)"/>
</g></g>
<path id="chain" d="M-16,-92.5 L-122,-89 A9,9 0 0 0 -122,-71 L-16,-47.5 A22.5,22.5 0 0 0 -16,-92.5 Z" fill="none" stroke-width="2.4" stroke-dasharray="2.6 1.8" style="stroke:var(--chain)"/>
<circle cx="-122" cy="-80" r="3.2" style="fill:var(--metal)"/>
<g transform="translate(-16,-70)"><g id="crankNear"><rect x="-4.5" y="-4.5" width="39" height="9" rx="4.5" style="fill:var(--metal)"/><circle r="4" style="fill:var(--metal-shade)"/></g></g>
<g id="pedalN"><rect x="-11" y="-3.5" width="22" height="7" rx="2" style="fill:var(--tire)"/><rect x="-3.5" y="-1.6" width="7" height="3.2" rx="1" style="fill:var(--flag)"/></g>
<!-- stem, swept-back bar, bell, grip -->
<path d="M89.5,-166.2 L86.3,-177 L97,-180" fill="none" stroke-width="5" stroke-linecap="round" stroke-linejoin="round" style="stroke:var(--metal)"/>
<path d="M97,-180 C107,-184 105,-195 91,-196 L70,-195" fill="none" stroke-width="4.5" stroke-linecap="round" style="stroke:var(--metal)"/>
<path d="M78,-196.5 A6,6 0 0 1 90,-196.5 Z" style="fill:var(--metal)"/>
<circle cx="84" cy="-203" r="1.6" style="fill:var(--metal-shade)"/>
<path d="M71,-194.5 L52,-193.5" stroke-width="8" stroke-linecap="round" style="stroke:var(--grip)"/>
<!-- wicker basket with the day's catch -->
<g transform="translate(118,-198) rotate(10)">
<path d="M0,0 C8,-4 9,-24 3,-38 L11,-50 L0,-45 L-11,-50 L-3,-38 C-9,-24 -8,-4 0,0 Z" style="fill:var(--fish)"/>
<path d="M-4,-36 L4,-36" stroke-width="1.5" style="stroke:var(--fish-shade)"/>
</g>
<g transform="translate(156,-236) rotate(162)">
<path d="M0,0 C8,-4 9,-24 3,-38 L11,-50 L0,-45 L-11,-50 L-3,-38 C-9,-24 -8,-4 0,0 Z" style="fill:var(--fish-shade)"/>
<circle cx="0" cy="-7" r="2.2" style="fill:var(--ink)"/>
</g>
<path d="M102,-218 L172,-218 L164,-172 L110,-172 Z" style="fill:var(--basket)"/>
<path d="M104,-207 L170,-207 M106,-196 L168,-196 M108,-185 L166,-185" stroke-width="2" style="stroke:var(--basket-shade)"/>
<path d="M116,-218 L120,-172 M130,-218 L131,-172 M144,-218 L143,-172 M158,-218 L154,-172" stroke-width="1.6" opacity=".7" style="stroke:var(--basket-shade)"/>
<rect x="98" y="-223" width="78" height="7" rx="3.5" style="fill:var(--basket-shade)"/>
<rect x="108" y="-175" width="58" height="4" rx="2" style="fill:var(--basket-shade)"/>
<circle cx="171" cy="-186" r="7.5" style="fill:var(--metal-shade)"/>
<circle cx="175" cy="-186" r="5.2" style="fill:var(--lamp-lens)"/>
<circle class="night-only" cx="178" cy="-186" r="26" fill="url(#gGlow)"/>
<!-- pelican: body -->
<g id="pelBody">
<use href="#bodyShape" style="fill:var(--bird)"/>
<g clip-path="url(#clipBody)">
<ellipse cx="-44" cy="-176" rx="120" ry="31" style="fill:var(--bird-shade)"/>
</g>
<use href="#bodyShape" fill="none" stroke-width="1.8" stroke-linejoin="round" style="stroke:var(--bird-line)"/>
<path d="M-138,-236 L-114,-241 M-137,-230 L-112,-233" fill="none" stroke-width="1.5" stroke-linecap="round" style="stroke:var(--bird-line)"/>
</g>
<!-- near leg (solved in script) -->
<g id="legNear">
<path id="shinN" fill="none" stroke-width="9" stroke-linecap="round" style="stroke:var(--leg)"/>
<g id="footN">
<path class="foot" style="fill:var(--leg)"/>
<path d="M3,-7.5 L20,-10 M3,-5.5 L23,-5" fill="none" stroke-width="1.2" stroke-linecap="round" style="stroke:var(--leg-shade)"/>
</g>
<path id="thighN" stroke-width="1.6" style="fill:var(--bird);stroke:var(--bird-line)"/>
</g>
<!-- pelican: neck, head, wing -->
<g id="pelUpper">
<g id="head">
<g transform="translate(40,-388)">
<path class="crestF" d="M0,0 C-8,-5 -18,-6 -26,-2 C-18,1 -8,2 0,0 Z" stroke-width="1" style="fill:var(--crest);stroke:var(--bird-line)"/>
<path class="crestF" d="M0,0 C-8,-5 -18,-6 -26,-2 C-18,1 -8,2 0,0 Z" stroke-width="1" style="fill:var(--crest);stroke:var(--bird-line)"/>
<path class="crestF" d="M0,0 C-8,-5 -18,-6 -26,-2 C-18,1 -8,2 0,0 Z" stroke-width="1" style="fill:var(--crest);stroke:var(--bird-line)"/>
</g>
<path d="M38,-262 C45,-282 47,-306 50,-326 C52,-340 56,-348 62,-354 L80,-364 L82,-386 C74,-394 60,-398 50,-394 C40,-390 34,-380 34,-370 C30,-356 22,-338 18,-318 C14,-300 8,-292 2,-290 L4,-262 Z" style="fill:var(--bird)"/>
<path d="M38,-262 C45,-282 47,-306 50,-326 C52,-340 56,-348 62,-354 M82,-386 C74,-394 60,-398 50,-394 C40,-390 34,-380 34,-370 C30,-356 22,-338 18,-318 C14,-300 8,-292 2,-290" fill="none" stroke-width="1.8" stroke-linecap="round" style="stroke:var(--bird-line)"/>
<path id="pouch" style="fill:var(--pouch)"/>
<path id="pouchLines" fill="none" stroke-width="1.2" stroke-linecap="round" style="stroke:var(--pouch-shade)"/>
<path d="M80,-374 C112,-365 150,-352 180,-341 L178,-337.5 C150,-348 112,-360 80,-367 Z" style="fill:var(--bill-shade)"/>
<path d="M82,-387 C112,-381 152,-362 183,-350 C189,-348 191,-341 186,-337 C184,-335 182,-338 180,-341 C150,-352 112,-366 80,-374 Z" style="fill:var(--bill)"/>
<path d="M90,-382 C120,-374 156,-358 178,-350 M92,-378.5 L104,-375.5" fill="none" stroke-width="1.2" stroke-linecap="round" style="stroke:var(--bill-shade)"/>
<path d="M177,-352 C184,-350 190,-345 187,-338 C185,-335 182,-338 180,-341 C181,-345 180,-349 177,-352 Z" style="fill:var(--bill-tip)"/>
<path d="M58,-380 C60,-388 74,-391 81,-385 L80,-371 C72,-366 62,-370 58,-380 Z" style="fill:var(--eye-ring)"/>
<circle cx="68" cy="-378" r="4.3" style="fill:var(--iris)"/>
<circle cx="68.4" cy="-378" r="2.3" style="fill:var(--ink)"/>
<circle cx="69.6" cy="-379.6" r="1.1" fill="#fff"/>
<ellipse id="lid" cx="68" cy="-378" rx="5.4" ry="5.4" transform="scale(1 0)" style="fill:var(--eye-ring)"/>
<path d="M59,-387 Q68,-392 77,-387.5" fill="none" stroke-width="1.8" stroke-linecap="round" style="stroke:var(--bird-line)"/>
</g>
<g id="wing">
<path d="M-66,-252 Q-58,-238 -48,-240 Q-40,-228 -28,-231 Q-18,-219 -6,-222 Q4,-211 16,-214 Q28,-206 38,-214 L36,-228 C10,-226 -30,-240 -60,-262 Z" style="fill:var(--bird-black)"/>
<path d="M34,-230 C44,-224 54,-212 62,-202 C66,-197 70,-194 72,-190 C73,-186 69,-184 66,-186 C65,-183 61,-182 58,-185 C56,-182 52,-183 51,-186 C47,-190 42,-200 30,-216 Z" style="fill:var(--bird-black)"/>
<path d="M-30,-286 C-4,-290 26,-272 40,-246 C46,-234 44,-222 34,-222 C8,-224 -30,-238 -58,-254 C-68,-260 -66,-272 -58,-278 C-50,-284 -40,-287 -30,-286 Z" stroke-width="1.8" stroke-linejoin="round" style="fill:var(--bird);stroke:var(--bird-line)"/>
<path d="M-50,-262 C-30,-252 -4,-244 24,-238 M-40,-274 C-22,-268 0,-260 22,-254" fill="none" stroke-width="1.3" stroke-linecap="round" style="stroke:var(--bird-line)"/>
</g>
<path d="M9,-309 Q29,-298 49,-309 L50,-293 Q30,-281 9,-294 Z" style="fill:var(--scarf-a)"/>
<path d="M22,-303 L22,-288 M36,-303.5 L36,-287.5" stroke-width="5" style="stroke:var(--scarf-b)"/>
<ellipse cx="9" cy="-300" rx="7" ry="8" style="fill:var(--scarf-a)"/>
</g>
<!-- scarf tails (simulated in script) -->
<g id="scarf" class="nt" fill="none" stroke-linejoin="round">
<path id="sc2" stroke-width="9" style="stroke:var(--scarf-a)"/>
<path id="sc2s" stroke-width="9" stroke-dasharray="6 6" style="stroke:var(--scarf-b)"/>
<path id="sc1" stroke-width="11" style="stroke:var(--scarf-a)"/>
<path id="sc1s" stroke-width="11" stroke-dasharray="7 7" style="stroke:var(--scarf-b)"/>
<path id="fringe" stroke-width="1.6" stroke-linecap="round" style="stroke:var(--scarf-a)"/>
</g>
</g>
<g id="lFront"></g>
<g id="speed" class="nt" fill="none" stroke-linecap="round" style="stroke:var(--wind)"></g>
Coast Road · 海岸公路
鹈鹕骑单车
沿着海岸公路,一直骑到日落。
变速
← → 换挡 空格 暂停 N 昼夜
(() => {
'use strict';
const NS = 'http://www.w3.org/2000/svg';
const $ = (id) => document.getElementById(id);
const mk = (tag, attrs, parent) => {
const e = document.createElementNS(NS, tag);
if (attrs) for (const k in attrs) e.setAttribute(k, attrs[k]);
if (parent) parent.appendChild(e);
return e;
};
const f1 = (n) => Math.round(n * 10) / 10;
const clamp = (v, a, b) => Math.min(b, Math.max(a, v));
const circ = (x, y, r) => `M${f1(x - r)},${f1(y)}a${f1(r)},${f1(r)} 0 1 0 ${f1(2 * r)},0a${f1(r)},${f1(r)} 0 1 0 ${f1(-2 * r)},0`;
const svg = $('scene');
const stage = $('stage');
// Seeded RNG: the coastline is the same on every visit.
let seed = 20260923;
const rnd = () => (seed = (seed * 16807) % 2147483647) / 2147483647;
const R = (a, b) => a + (b - a) * rnd();
/* ---------- parallax tiling ----------
Each layer is one tile template cloned edge to edge across the view,
then shifted by (distance * depth factor) modulo the tile width. */
const layers = ;
let view = { x0: -576, x1: 576, y0: -500, y1: 220 };
let swayEls = , beamEls = ;
function layer(parentId, w, f, build, drift = 0) {
const tpl = mk(‘g’);
build(tpl, w);
const L = { host: mk(‘g’, {}, $(parentId)), tpl, w, f, drift, dy: 0 };
layers.push(L);
return L;
}
function populate() {
for (const L of layers) {
const k0 = Math.floor(view.x0 / L.w) - 1, k1 = Math.ceil(view.x1 / L.w);
const frag = document.createDocumentFragment();
for (let k = k0; k <= k1; k++) {
const c = L.tpl.cloneNode(true);
c.setAttribute(‘transform’, translate(${k * L.w},0));
frag.appendChild(c);
}
L.host.replaceChildren(frag);
}
swayEls = […svg.querySelectorAll(‘.sway’)].map((el) => ({
el, base: el.getAttribute(‘transform’), ph: +el.dataset.ph,
}));
beamEls = […svg.querySelectorAll(‘.lh-beam’)];
}
/* ---------- sky ---------- */
function cloudPath(cx, cy, s) {
const w = 150 * s, h = 46 * s, x0 = cx - w / 2;
const arc = (r, dx, dy) => a${f1(r)},${f1(r)} 0 0 1 ${f1(dx)},${f1(dy)};
return M${f1(x0)},${f1(cy)} + arc(h * .5, w * .18, -h * .55) + arc(h * .62, w * .3, -h * .35) +
arc(h * .75, w * .32, h * .15) + arc(h * .5, w * .2, h * .75) + ‘Z’;
}
layer(‘lClouds’, 2400, 0.03, (g, w) => {
let shade = ‘’, body = ‘’;
for (let i = 0; i < 8; i++) {
const cx = (i + 0.5) * w / 8 + R(-90, 90), cy = R(-900, -330);
const s = R(0.55, 1.3) * (cy < -600 ? 1.25 : 1);
shade += cloudPath(cx + 7 * s, cy + 6 * s, s);
body += cloudPath(cx, cy, s);
}
mk(‘path’, { d: shade, style: ‘fill:var(–cloud-shade)’ }, g);
mk(‘path’, { d: body, style: ‘fill:var(–cloud)’ }, g);
}, 6);
(function stars() {
const host = $(‘stars’);
for (let k = 0; k < 3; k++) {
let d = ‘’;
for (let i = 0; i < 90; i++) {
const u = rnd();
d += circ(R(-1800, 1800), -232 - 1070 * u * u, R(0.6, 1.7) * (k === 0 ? 1.25 : 1));
}
mk(‘path’, { d, class: ‘twinkle’, style: fill:var(--star);animation-delay:${-k * 1.1}s;animation-duration:${2.4 + k * 0.9}s }, host);
}
})();
layer(‘lFar’, 2400, 0.06, (g) => {
mk(‘path’, { d: ‘M1320,-205 C1380,-213 1440,-223 1510,-225 C1580,-227 1640,-214 1710,-205 Z M1900,-205 C1930,-209 1960,-213 1990,-212 C2020,-211 2040,-207 2060,-205 Z’, style: ‘fill:var(–far-1)’ }, g);
mk(‘path’, { d: ‘M240,-205 C320,-212 380,-236 460,-250 C520,-262 580,-268 640,-266 L700,-262 C760,-258 800,-240 850,-222 C880,-212 910,-207 950,-205 Z’, style: ‘fill:var(–far-2)’ }, g);
const lh = mk(‘g’, { transform: ‘translate(662,-265)’ }, g);
const beam = mk(‘g’, { transform: ‘translate(0,-39)’, class: ‘night-only’ }, lh);
mk(‘path’, { d: ‘M0,-3 L320,-26 L320,20 L0,3 Z’, fill: ‘url(#gLhBeam)’, class: ‘lh-beam’ }, beam);
mk(‘path’, { d: ‘M-9,0 L9,0 L6,-34 L-6,-34 Z’, style: ‘fill:var(–lh)’ }, lh);
mk(‘path’, { d: ‘M-8.3,-8 L8.3,-8 L7.7,-15 L-7.7,-15 Z M-7.1,-22 L7.1,-22 L6.5,-28 L-6.5,-28 Z’, style: ‘fill:var(–lh-stripe)’ }, lh);
mk(‘rect’, { x: -6, y: -43, width: 12, height: 9, style: ‘fill:var(–lh-room)’ }, lh);
mk(‘path’, { d: ‘M-8.5,-43 L0,-51 L8.5,-43 Z’, style: ‘fill:var(–lh-stripe)’ }, lh);
mk(‘circle’, { cx: 0, cy: -39, r: 18, fill: ‘url(#gGlow)’, class: ‘night-only’ }, lh);
});
/* ---------- sea ---------- */
(function glitter() {
const host = $(‘glitter’);
for (let i = 0; i < 26; i++) {
const p = i / 25, y = -201 + p * 104 + R(-1.5, 1.5);
const hw = 6 + p * p * 58 + R(-4, 6), x = -120 + R(-8, 8) * (0.4 + p);
mk(‘path’, {
d: M${f1(x - hw)},${f1(y)}h${f1(hw * 2)}, class: ‘glint’, ‘stroke-width’: f1(1 + p * 2.2), ‘stroke-linecap’: ‘round’,
style: stroke:var(--glitter);animation-delay:${f1(-R(0, 2.4))}s;animation-duration:${f1(R(1.6, 3.2))}s,
}, host);
}
})();
function waves(id, f, rows, lo, hi, sw, op, n) {
layer(id, 1200, f, (g, w) => {
let d = ‘’;
for (const y of rows) for (let i = 0; i < n; i++) d += M${f1(R(0, w))},${f1(y + R(-1.2, 1.2))}h${f1(R(lo, hi))};
mk(‘path’, { d, fill: ‘none’, ‘stroke-width’: sw, ‘stroke-linecap’: ‘round’, opacity: op, style: ‘stroke:var(–wave)’ }, g);
});
}
waves(‘lWaveFar’, 0.1, [-198, -191, -183, -174], 6, 22, 1.2, 0.55, 9);
waves(‘lWaveNear’, 0.2, [-163, -151, -138, -124, -110, -100], 14, 46, 2.2, 0.7, 7);
const boat = mk(‘g’, {}, $(‘boat’));
mk(‘path’, { d: ‘M-22,0 L22,0 L16,7 L-16,7 Z’, style: ‘fill:var(–ink)’ }, boat);
mk(‘path’, { d: ‘M1,-3 L1,-42 L22,-4 Z M-2,-5 L-2,-34 L-17,-5 Z’, style: ‘fill:var(–fence)’ }, boat);
mk(‘path’, { d: ‘M-0.5,-44 L-0.5,0’, ‘stroke-width’: 1.5, style: ‘stroke:var(–ink)’ }, boat);
const boatState = { x: 260 };
const foam = layer(‘lFoam’, 1200, 0.42, (g, w) => {
let d = ‘M0,-89 L0,-94’;
for (let x = 0; x < w; x += 40) d += Q${x + 20},${f1(-99 - R(0, 3))} ${x + 40},-94;
d += L${w},-89 Z;
mk(‘path’, { d, style: ‘fill:var(–foam)’ }, g);
let lace = ‘’;
for (let i = 0; i < 18; i++) lace += M${f1(R(0, w))},${f1(R(-104, -100))}h${f1(R(20, 70))};
mk(‘path’, { d: lace, fill: ‘none’, ‘stroke-width’: 1.6, ‘stroke-linecap’: ‘round’, opacity: 0.7, style: ‘stroke:var(–foam)’ }, g);
});
/* ---------- beach ---------- */
function palm(g, x, base, h, lean, ph) {
const pts = [ ];
for (let i = 0; i <= 12; i++) {
const t = i / 12, u = 1 - t;
pts.push({ x: u * u * x + 2 * u * t * (x + lean * 0.15) + t * t * (x + lean), y: base - h * t, w: 9 - 4.5 * t });
}
let left = ‘’, right = ‘’;
pts.forEach((p, i) => {
left += ${i ? 'L' : 'M'}${f1(p.x - p.w)},${f1(p.y)};
right = L${f1(p.x + p.w)},${f1(p.y)} + right;
});
mk(‘path’, { d: left + right + ‘Z’, style: ‘fill:var(–trunk)’ }, g);
let rings = ‘’;
for (let i = 1; i < 12; i++) rings += M${f1(pts[i].x - pts[i].w)},${f1(pts[i].y + 2)}l${f1(pts[i].w * 2)},-3;
mk(‘path’, { d: rings, fill: ‘none’, ‘stroke-width’: 1.4, style: ‘stroke:var(–trunk-ring)’ }, g);
const top = pts[12];
const crown = mk(‘g’, { class: ‘sway’, transform: translate(${f1(top.x)},${f1(top.y)}), ‘data-ph’: ph }, g);
const leaf = (deg, L, droop) => {
const a = deg * Math.PI / 180, c = Math.cos(a), s = Math.sin(a), w = L * 0.16;
const tx = L * c, ty = L * s + droop, cx = 0.55 * L * c, cy = 0.55 * L * s - droop * 0.25;
return M0,0Q${f1(cx - s * w)},${f1(cy + c * w)} ${f1(tx)},${f1(ty)}Q${f1(cx + s * w)},${f1(cy - c * w)} 0,0Z;
};
let back = ‘’, front = ‘’;
[[-160, 96, 40], [-120, 84, 30], [-60, 88, 28], [-15, 100, 44]].forEach(([a, L, d]) => { back += leaf(a, L, d); });
[[-178, 104, 56], [-138, 92, 42], [-92, 70, 20], [-38, 96, 40], [8, 98, 58]].forEach(([a, L, d]) => { front += leaf(a, L, d); });
mk(‘path’, { d: back, style: ‘fill:var(–leaf-2)’ }, crown);
mk(‘path’, { d: circ(-5, 6, 5.5) + circ(5, 7, 5.5) + circ(0, 12, 5.5), style: ‘fill:var(–coconut)’ }, crown);
mk(‘path’, { d: front, style: ‘fill:var(–leaf)’ }, crown);
}
function umbrella(g, x, base, tilt) {
const u = mk(‘g’, { transform: translate(${x},${base}) rotate(${tilt}) }, g);
mk(‘rect’, { x: 8, y: 2, width: 46, height: 7, rx: 1.5, transform: rotate(${-tilt}), style: ‘fill:var(–towel)’ }, u);
mk(‘path’, { d: ‘M0,4 L0,-74’, ‘stroke-width’: 3, style: ‘stroke:var(–trunk)’ }, u);
mk(‘path’, { d: ‘M-44,-66 Q0,-104 44,-66 Q33,-61 22,-66 Q11,-61 0,-66 Q-11,-61 -22,-66 Q-33,-61 -44,-66 Z’, style: ‘fill:var(–umb-b)’ }, u);
mk(‘path’, { d: ‘M0,-85 Q-30,-83 -44,-66 Q-33,-61 -22,-66 Q-13,-77 0,-85 Z M0,-85 L0,-66 Q11,-61 22,-66 Q13,-77 0,-85 Z’, style: ‘fill:var(–umb-a)’ }, u);
mk(‘circle’, { cx: 0, cy: -87, r: 2.5, style: ‘fill:var(–umb-a)’ }, u);
}
function lifeguard(g, x, base) {
const t = mk(‘g’, { transform: translate(${x},${base}) }, g);
mk(‘path’, { d: ‘M-24,0 L-18,-62 M24,0 L18,-62 M-22,-18 L20,-46 M22,-18 L-20,-46 M28,-60 L72,0’, fill: ‘none’, ‘stroke-width’: 3.2, ‘stroke-linecap’: ‘round’, style: ‘stroke:var(–trunk)’ }, t);
mk(‘rect’, { x: -31, y: -65, width: 62, height: 5, rx: 1, style: ‘fill:var(–trunk)’ }, t);
mk(‘rect’, { x: -26, y: -102, width: 52, height: 38, style: ‘fill:var(–umb-b)’ }, t);
mk(‘rect’, { x: -17, y: -95, width: 34, height: 14, rx: 2, opacity: 0.75, style: ‘fill:var(–ink)’ }, t);
mk(‘path’, { d: ‘M-33,-100 L0,-119 L33,-100 Z’, style: ‘fill:var(–umb-a)’ }, t);
mk(‘path’, { d: ‘M0,-119 L0,-142’, ‘stroke-width’: 1.8, style: ‘stroke:var(–trunk)’ }, t);
mk(‘path’, { d: ‘M0,-142 L16,-137 L0,-132 Z’, style: ‘fill:var(–flag)’ }, t);
}
layer(‘lBeach’, 1800, 0.42, (g) => {
palm(g, 260, -66, 330, 46, 0);
umbrella(g, 560, -48, -6);
lifeguard(g, 900, -50);
umbrella(g, 1240, -40, 5);
palm(g, 1470, -72, 300, -34, 1.7);
palm(g, 1580, -58, 250, 44, 3.1);
});
/* ---------- roadside ---------- */
function blades(x, y, n, lo, hi, spread = 0.6) {
let a1 = ‘’, a2 = ‘’;
for (let j = 0; j < n; j++) {
const a = -Math.PI / 2 + R(-spread, spread), len = R(lo, hi), bx = x + R(-5, 5);
const seg = M${f1(bx)},${f1(y)}Q${f1(bx + Math.cos(a) * len * 0.25)},${f1(y - len * 0.6)} ${f1(bx + Math.cos(a) * len)},${f1(y + Math.sin(a) * len)};
if (j % 2) a1 += seg; else a2 += seg;
}
return [a1, a2];
}
const strokePath = (g, d, sw, color, extra = {}) =>
mk(‘path’, Object.assign({ d, fill: ‘none’, ‘stroke-width’: sw, ‘stroke-linecap’: ‘round’, style: stroke:var(${color}) }, extra), g);
layer(‘lDune’, 600, 0.8, (g, w) => {
let d = ‘M0,-24 L0,-38’;
for (let x = 0; x < w; x += 100) d += Q${x + 50},${f1(-50 + R(-3, 3))} ${x + 100},-38;
mk(‘path’, { d: d + L${w},-24 Z, style: ‘fill:var(–sand-shade)’ }, g);
let g1 = ‘’, g2 = ‘’;
for (let i = 0; i < 16; i++) { const [a, b] = blades(R(0, w), -38, 4 + (rnd() * 4 | 0), 9, 22, 0.7); g1 += a; g2 += b; }
strokePath(g, g2, 1.8, ‘–grass-dark’);
strokePath(g, g1, 1.8, ‘–grass’);
});
layer(‘lFence’, 600, 0.95, (g, w) => {
mk(‘rect’, { x: 0, y: -53, width: w, height: 3.5, style: ‘fill:var(–fence-shade)’ }, g);
mk(‘rect’, { x: 0, y: -41, width: w, height: 3.5, style: ‘fill:var(–fence-shade)’ }, g);
let d = ‘’;
for (let x = 10; x < w; x += 50) d += M${x},-26 v-31 l3.5,-5 l3.5,5 v31 Z;
mk(‘path’, { d, style: ‘fill:var(–fence)’ }, g);
});
layer(‘lFence’, 1200, 0.95, (g) => {
const x = 900;
mk(‘path’, { d: M${x},-30 L${x},-292 Q${x},-306 ${x + 16},-306 L${x + 30},-306, fill: ‘none’, ‘stroke-width’: 5, ‘stroke-linecap’: ‘round’, style: ‘stroke:var(–lamp-post)’ }, g);
mk(‘rect’, { x: x - 6, y: -42, width: 12, height: 16, rx: 2, style: ‘fill:var(–lamp-post)’ }, g);
mk(‘path’, { d: M${x + 24},-307 L${x + 46},-307 L${x + 41},-297 L${x + 29},-297 Z, style: ‘fill:var(–lamp-post)’ }, g);
mk(‘circle’, { cx: x + 35, cy: -296, r: 4, style: ‘fill:var(–lamp-bulb)’ }, g);
const glow = mk(‘g’, { class: ‘night-only’ }, g);
mk(‘path’, { d: M${x + 29},-297 L${x + 41},-297 L${x + 100},-24 L${x - 30},-24 Z, fill: ‘url(#gCone)’ }, glow);
mk(‘circle’, { cx: x + 35, cy: -294, r: 48, fill: ‘url(#gGlow)’ }, glow);
});
layer(‘lPools’, 1200, 0.95, (g) => {
mk(‘ellipse’, { cx: 935, cy: -4, rx: 95, ry: 14, fill: ‘url(#gPool)’ }, g);
});
layer(‘lRoad’, 600, 1, (g, w) => {
let d = ‘’;
for (let i = 0; i < 70; i++) d += M${f1(R(0, w))},${f1(R(-20, 42))}h${f1(R(1, 5))};
strokePath(g, d, 1.6, ‘–road-speck’);
let dash = ‘’;
for (let x = 0; x < w; x += 150) dash += M${x + 20},14h70v4h-70Z;
mk(‘path’, { d: dash, style: ‘fill:var(–road-line)’ }, g);
});
layer(‘lVerge’, 900, 1.3, (g, w) => {
let g1 = ‘’, g2 = ‘’, stems = ‘’, fa = ‘’, fb = ‘’;
const add = ([a, b]) => { g1 += a; g2 += b; };
for (let i = 0; i < 22; i++) add(blades(R(0, w), 58 + R(0, 10), 5 + (rnd() * 4 | 0), 10, 26));
for (let i = 0; i < 26; i++) add(blades(R(0, w), R(90, 700), 4 + (rnd() * 3 | 0), 8, 20));
for (let i = 0; i < 10; i++) {
const x = R(0, w), y = 60 + R(0, 8), h = R(14, 26);
stems += M${f1(x)},${f1(y)}q2,${f1(-h / 2)} 0,${f1(-h)};
if (i % 2) fa += circ(x, y - h, R(2.6, 3.6)); else fb += circ(x, y - h, R(2.6, 3.6));
}
strokePath(g, g2, 2.2, ‘–grass-dark’);
strokePath(g, g1, 2.2, ‘–grass’);
strokePath(g, stems, 1.4, ‘–grass-dark’);
mk(‘path’, { d: fa, style: ‘fill:var(–flower-a)’ }, g);
mk(‘path’, { d: fb, style: ‘fill:var(–flower-b)’ }, g);
});
layer(‘lFront’, 1400, 1.75, (g, w) => {
let g1 = ‘’, g2 = ‘’;
for (let i = 0; i < 4; i++) { const [a, b] = blades(R(0, w), 212 + R(0, 30), 9, 30, 72, 0.5); g1 += a; g2 += b; }
strokePath(g, g2, 4, ‘–grass-dark’);
strokePath(g, g1, 4, ‘–verge-2’);
});
/* ---------- sky life & wind ---------- */
const gulls = [0, 1, 2].map(() => ({
p: mk(‘path’, { fill: ‘none’, ‘stroke-width’: 2.2, ‘stroke-linecap’: ‘round’, ‘stroke-linejoin’: ‘round’, style: ‘stroke:var(–ink)’ }, $(‘gulls’)),
x: R(-520, 520), y: R(-470, -300), s: R(0.7, 1.15), ph: R(0, 6), sp: R(0.8, 1.2),
}));
const streaks = Array.from({ length: 9 }, () => ({
p: mk(‘path’, { ‘stroke-width’: f1(R(1.2, 2.4)) }, $(‘speed’)),
x: R(-700, 700), y: R(-430, -20), len: R(60, 160), k: R(1.6, 2.6), o: R(0.5, 1),
}));
/* ---------- adaptive framing ----------
Keep a 640 x 720 safe box around the rider visible at any aspect ratio;
on tall screens the extra height is split between sky and roadside so
the rider stays clear of the handlebar computer. */
function fit() {
const w = stage.clientWidth || innerWidth, h = stage.clientHeight || innerHeight;
const a = w / h, minW = 640, minH = 720;
let vw, vh;
if (a >= minW / minH) { vh = minH; vw = vh * a; } else { vw = minW; vh = vw / a; }
const y0 = -500 - (vh - minH) * 0.5;
svg.setAttribute(‘viewBox’, ${f1(-vw / 2)} ${f1(y0)} ${f1(vw)} ${f1(vh)});
view = { x0: -vw / 2, x1: vw / 2, y0, y1: y0 + vh };
populate();
}
/* ---------- the bicycle ---------- */
function buildWheel(g) {
mk(‘circle’, { r: 74, fill: ‘none’, ‘stroke-width’: 11, style: ‘stroke:var(–tire)’ }, g);
mk(‘circle’, { r: 77.6, fill: ‘none’, ‘stroke-width’: 1.6, ‘stroke-dasharray’: ‘5 9’, style: ‘stroke:var(–tire-hi)’ }, g);
mk(‘circle’, { r: 67.5, fill: ‘none’, ‘stroke-width’: 3.5, style: ‘stroke:var(–metal)’ }, g);
let d = ‘’;
for (let i = 0; i < 16; i++) {
const a = i * Math.PI / 8, h = a + (i % 2 ? 0.5 : -0.5);
d += M${f1(Math.cos(h) * 6)},${f1(Math.sin(h) * 6)}L${f1(Math.cos(a) * 66)},${f1(Math.sin(a) * 66)};
}
mk(‘path’, { d, fill: ‘none’, ‘stroke-width’: 1.3, style: ‘stroke:var(–metal)’ }, g);
const blur = mk(‘circle’, { r: 66, fill: ‘url(#gBlur)’, class: ‘nt’, opacity: 0 }, g);
mk(‘circle’, { r: 7.5, ‘stroke-width’: 1.5, style: ‘fill:var(–metal);stroke:var(–metal-shade)’ }, g);
mk(‘rect’, { x: 34, y: -3, width: 15, height: 6, rx: 2, transform: ‘rotate(11)’, style: ‘fill:var(–flag)’ }, g);
mk(‘rect’, { x: 58, y: -1.6, width: 8, height: 3.2, rx: 1, transform: ‘rotate(-60)’, style: ‘fill:var(–metal-shade)’ }, g);
return blur;
}
const wheelR = ('wheelR'), wheelF = (‘wheelF’);
const blurs = [buildWheel(wheelR), buildWheel(wheelF)];
const FOOT = ‘M-14,-9 Q-13,-3 -7,-3 L21,-3 Q27,-3 27,-6 Q23,-7 25,-10 Q20,-10 21,-13 Q12,-11 2,-10 Q-9,-12 -14,-9 Z’;
document.querySelectorAll(‘.foot’).forEach((p) => p.setAttribute(‘d’, FOOT));
const el = Object.fromEntries([‘pelBody’, ‘pelUpper’, ‘head’, ‘wing’, ‘pouch’, ‘pouchLines’, ‘lid’, ‘ring’, ‘chain’,
‘crankNear’, ‘crankFar’, ‘pedalN’, ‘pedalF’, ‘shinN’, ‘footN’, ‘thighN’, ‘shinF’, ‘footF’, ‘thighF’,
‘flagPole’, ‘flagCloth’, ‘sc1’, ‘sc1s’, ‘sc2’, ‘sc2s’, ‘fringe’, ‘sub’, ‘btnTheme’, ‘btnPause’].map((k) => [k, $(k)]));
const crest = […document.querySelectorAll(‘.crestF’)];
/* ---------- rider kinematics ----------
The pelican’s torso is one rigid pose (bob + lean about the hip);
legs are solved with two-bone IK from the hip to each pedal. */
const BB = { x: -16, y: -70 }, CR = 30, L1 = 76, L2 = 84;
const HIP_N = { x: -36, y: -206 }, HIP_F = { x: -30, y: -210 };
const PIV = { x: -36, y: -206 };
const pose = { bob: 0, lean: 0, c: 1, s: 0 };
const toWorld = (x, y) => {
const dx = x - PIV.x, dy = y - PIV.y;
return { x: PIV.x + dx * pose.c - dy * pose.s, y: PIV.y + dx * pose.s + dy * pose.c + pose.bob };
};
const toLocal = (x, y) => {
const dx = x - PIV.x, dy = y - pose.bob - PIV.y;
return { x: PIV.x + dx * pose.c + dy * pose.s, y: PIV.y - dx * pose.s + dy * pose.c };
};
function ik(ax, ay, bx, by, l1, l2, bend) {
const dx = bx - ax, dy = by - ay;
const d = clamp(Math.hypot(dx, dy), Math.abs(l1 - l2) + 0.01, l1 + l2 - 0.01);
const a = Math.acos(clamp((l1 * l1 + d * d - l2 * l2) / (2 * l1 * d), -1, 1));
const ang = Math.atan2(dy, dx) + bend * a;
return { x: ax + Math.cos(ang) * l1, y: ay + Math.sin(ang) * l1 };
}
function thighPath(h, k, r1, r2) {
const dx = k.x - h.x, dy = k.y - h.y, L = Math.hypot(dx, dy) || 1;
const nx = -dy / L, ny = dx / L;
return M${f1(h.x + nx * r1)},${f1(h.y + ny * r1)}L${f1(k.x + nx * r2)},${f1(k.y + ny * r2)} +
A${r2},${r2} 0 0 0 ${f1(k.x - nx * r2)},${f1(k.y - ny * r2)} +
L${f1(h.x - nx * r1)},${f1(h.y - ny * r1)}A${r1},${r1} 0 0 0 ${f1(h.x + nx * r1)},${f1(h.y + ny * r1)}Z;
}
function leg(hipL, ang, footAng, shin, footG, pedal, thigh, r1, r2) {
const hip = toWorld(hipL.x, hipL.y);
const px = BB.x + Math.cos(ang) * CR, py = BB.y + Math.sin(ang) * CR;
const ca = Math.cos(footAng), sa = Math.sin(footAng);
const ank = { x: px - 11 * ca + 14 * sa, y: py - 11 * sa - 14 * ca };
const knee = ik(hip.x, hip.y, ank.x, ank.y, L1, L2, -1);
const tf = translate(${f1(px)},${f1(py)}) rotate(${f1(footAng * 180 / Math.PI)});
shin.setAttribute(‘d’, M${f1(knee.x)},${f1(knee.y)}L${f1(ank.x)},${f1(ank.y)});
footG.setAttribute(‘transform’, tf);
pedal.setAttribute(‘transform’, tf);
thigh.setAttribute(‘d’, thighPath(hip, knee, r1, r2));
}
// The wing is drawn for a rest pose; each frame it is rotated/scaled about
// the shoulder so the wingtip stays wrapped around the (fixed) grip.
const SH = { x: -6, y: -270 }, GRIP = { x: 61, y: -194 };
const wingA0 = Math.atan2(GRIP.y - SH.y, GRIP.x - SH.x), wingD0 = Math.hypot(GRIP.x - SH.x, GRIP.y - SH.y);
/* ---------- scarf: two Verlet ribbons in the headwind ---------- */
const tails = [[12, 8.5, 0], [8, 7.5, 2.1]].map(([n, seg, ph]) => ({
seg, ph, pts: Array.from({ length: n }, (_, i) => ({ x: 9 - i * seg, y: -300, px: 9 - i * seg, py: -300 })),
}));
function stepTail(T, ax, ay, h, v, t) {
const P = T.pts, air = -(v * 0.9 + 60);
P[0].x = P[0].px = ax; P[0].y = P[0].py = ay;
for (let i = 1; i < P.length; i++) {
const p = P[i], vx = (p.x - p.px) / h, vy = (p.y - p.py) / h;
const flut = Math.sin(t * 13 + i * 0.8 + T.ph) * (90 + v * 0.35) + Math.sin(t * 21 + i * 1.7 + T.ph * 2) * 50;
const nx = p.x + (p.x - p.px) * 0.98 + (air - vx) * 4.2 * h * h;
const ny = p.y + (p.y - p.py) * 0.98 + (520 - vy * 1.2 + flut) * h * h;
p.px = p.x; p.py = p.y; p.x = nx; p.y = ny;
}
for (let k = 0; k < 6; k++) {
for (let i = 1; i < P.length; i++) {
const a = P[i - 1], b = P[i], dx = b.x - a.x, dy = b.y - a.y, d = Math.hypot(dx, dy) || 1e-6;
const q = (d - T.seg) / d;
if (i === 1) { b.x -= dx * q; b.y -= dy * q; }
else { a.x += dx * q * 0.5; a.y += dy * q * 0.5; b.x -= dx * q * 0.5; b.y -= dy * q * 0.5; }
}
}
}
function ribbon(P) {
let d = M${f1(P[0].x)},${f1(P[0].y)};
for (let i = 1; i < P.length - 1; i++) {
d += Q${f1(P[i].x)},${f1(P[i].y)} ${f1((P[i].x + P[i + 1].x) / 2)},${f1((P[i].y + P[i + 1].y) / 2)};
}
const L = P[P.length - 1];
return d + L${f1(L.x)},${f1(L.y)};
}
function fringe(P, half) {
const a = P[P.length - 2], b = P[P.length - 1], dx = b.x - a.x, dy = b.y - a.y, L = Math.hypot(dx, dy) || 1;
const ux = dx / L, uy = dy / L;
let d = ‘’;
for (let i = 0; i < 4; i++) {
const o = -half + (2 * half * i) / 3, sx = b.x - uy * o, sy = b.y + ux * o;
d += M${f1(sx)},${f1(sy)}l${f1(ux * 7)},${f1(uy * 7)};
}
return d;
}
/* ---------- state ---------- */
const GEARS = [210, 290, 370, 450, 530, 615, 700];
const KMH = 0.05; // scene units per second → km/h
const S = {
gear: 3, v: GEARS[3], dist: 300, t: 0, crank: 0.4, jig: 0, jigV: 0,
blinkAt: 2.2, blinkT: -1, hudAt: 0,
};
let paused = false;
const cadence = (v) => 50 + (v - 210) / 490 * 46; // rpm
function simulate(dt) {
S.t += dt;
S.v += (GEARS[S.gear] - S.v) * (1 - Math.exp(-dt * 1.4));
S.dist += S.v * dt;
const w = cadence(S.v) / 60 * Math.PI * 2;
S.crank += w * dt;
// pouch: damped spring driven by the torso’s vertical acceleration
const acc = -4 * 2.2 * w * w * Math.sin(2 * S.crank);
S.jigV += (-140 * S.jig - 7 * S.jigV - acc * 0.9) * dt;
S.jig = clamp(S.jig + S.jigV * dt, -9, 9);
// scarf, fixed 120 Hz substeps
const n = Math.max(1, Math.round(dt * 120)), h = dt / n;
for (let k = 0; k < n; k++) {
const tt = S.t - dt + h * (k + 1);
tails.forEach((T, i) => { const a = toWorld(9, -300 + i * 4); stepTail(T, a.x, a.y, h, S.v, tt); });
}
if (S.blinkT < 0 && S.t > S.blinkAt) S.blinkT = 0;
if (S.blinkT >= 0) {
S.blinkT += dt;
if (S.blinkT > 0.18) { S.blinkT = -1; S.blinkAt = S.t + (rnd() < 0.25 ? 0.25 : R(2.4, 5.5)); }
}
}
function render() {
const { t, v, crank: th } = S;
const sp = clamp((v - 210) / 490, 0, 1);
// torso pose
pose.bob = 2.2 * Math.sin(2 * th);
pose.lean = (2 + 3 * sp + 0.8 * Math.sin(2 * th + 1)) * Math.PI / 180;
pose.c = Math.cos(pose.lean); pose.s = Math.sin(pose.lean);
const tf = `translate(0,${pose.bob.toFixed(2)}) rotate(${(pose.lean * 180 / Math.PI).toFixed(2)},${PIV.x},${PIV.y})`;
el.pelBody.setAttribute('transform', tf);
el.pelUpper.setAttribute('transform', tf);
// legs (far pedal is half a turn behind)
leg(HIP_F, th + Math.PI, 0.05 + 0.22 * Math.sin(th + Math.PI - 0.4), el.shinF, el.footF, el.pedalF, el.thighF, 15, 8.5);
leg(HIP_N, th, 0.05 + 0.22 * Math.sin(th - 0.4), el.shinN, el.footN, el.pedalN, el.thighN, 17, 9.5);
// wing follows the grip
const g = toLocal(GRIP.x, GRIP.y);
const wr = (Math.atan2(g.y - SH.y, g.x - SH.x) - wingA0) * 180 / Math.PI;
const ws = Math.hypot(g.x - SH.x, g.y - SH.y) / wingD0;
el.wing.setAttribute('transform', `translate(${SH.x},${SH.y}) rotate(${wr.toFixed(2)}) scale(${ws.toFixed(4)}) translate(${-SH.x},${-SH.y})`);
// head stays steadier than the body, with a lagged nod
const hr = -0.6 * pose.lean * 180 / Math.PI + 1.4 * Math.sin(2 * th - 0.6) + 1.6 * Math.sin(t * 0.37);
el.head.setAttribute('transform', `rotate(${hr.toFixed(2)},22,-280)`);
crest.forEach((c, i) => {
const a = [26, 12, -2][i] - sp * 8 + Math.sin(t * (9 + i * 2.3) * (0.6 + sp) + i * 1.3) * (3 + sp * 5);
c.setAttribute('transform', `rotate(${a.toFixed(1)})`);
});
const j = S.jig;
el.pouch.setAttribute('d', `M80,-372 C72,-368 64,-362 60,-354 C64,${f1(-338 + j * 0.6)} 90,${f1(-320 + j)} 112,${f1(-322 + j)} C140,${f1(-324 + j * 0.7)} 164,-334 178,-341 C150,-350 112,-362 80,-372 Z`);
el.pouchLines.setAttribute('d', `M76,${f1(-348 + j * 0.4)} Q102,${f1(-331 + j)} 130,${f1(-334 + j * 0.8)} M94,${f1(-358 + j * 0.2)} Q116,${f1(-345 + j * 0.5)} 146,-344`);
const lid = S.blinkT >= 0 ? Math.sin(Math.PI * S.blinkT / 0.18) : 0;
el.lid.setAttribute('transform', `translate(68,-383.4) scale(1,${lid.toFixed(3)}) translate(-68,383.4)`);
// drivetrain
const cd = (th * 180 / Math.PI).toFixed(2);
el.crankNear.setAttribute('transform', `rotate(${cd})`);
el.crankFar.setAttribute('transform', `rotate(${cd})`);
el.ring.setAttribute('transform', `rotate(${cd})`);
el.chain.setAttribute('stroke-dashoffset', (th * 22.5 % 4.4).toFixed(2));
const wd = `rotate(${((S.dist / 80) * 180 / Math.PI % 360).toFixed(2)})`;
wheelR.setAttribute('transform', wd);
wheelF.setAttribute('transform', wd);
const bo = clamp((v - 420) / 280, 0, 0.9).toFixed(2);
blurs.forEach((b) => b.setAttribute('opacity', bo));
// safety flag: pole flexes, cloth ripples
const bend = 6 + v * 0.014, tipX = -168 - bend, tipY = -330 + bend * 0.25;
el.flagPole.setAttribute('d', `M-126,-92 Q${f1(-146 - bend * 0.3)},-210 ${f1(tipX)},${f1(tipY)}`);
const amp = 2.5 + v * 0.005, om = 11 + v * 0.02;
const wave = (s) => amp * s * Math.sin(9 * s - om * t);
let top = '', bot = '';
for (let i = 0; i <= 8; i++) {
const s = i / 8;
top += `${i ? 'L' : 'M'}${f1(tipX - 64 * s)},${f1(tipY + 13 * s + wave(s))}`;
bot = `L${f1(tipX + 3 - 67 * s)},${f1(tipY + 26 - 13 * s + wave(s))}` + bot;
}
el.flagCloth.setAttribute('d', top + bot + 'Z');
// scarf tails
const [t1, t2] = tails;
const r1 = ribbon(t1.pts), r2 = ribbon(t2.pts);
el.sc1.setAttribute('d', r1); el.sc1s.setAttribute('d', r1);
el.sc2.setAttribute('d', r2); el.sc2s.setAttribute('d', r2);
el.fringe.setAttribute('d', fringe(t1.pts, 4.5) + fringe(t2.pts, 3.6));
// world
for (const L of layers) {
const off = (S.dist * L.f + t * L.drift) % L.w;
L.host.setAttribute('transform', `translate(${(-off).toFixed(2)},${L.dy.toFixed(2)})`);
}
foam.dy = 2.2 * Math.sin(t * 0.8);
const sweep = Math.cos(t * 0.7).toFixed(3);
beamEls.forEach((b) => b.setAttribute('transform', `scale(${sweep},1)`));
swayEls.forEach((s) => s.el.setAttribute('transform', `${s.base} rotate(${(Math.sin(t * 1.3 + s.ph) * 2.6).toFixed(2)})`));
for (const q of gulls) {
const fl = Math.sin(t * 7 * q.sp + q.ph), s = q.s * 12, tip = q.s * (2 + 6 * fl), y = q.y + Math.sin(t * 0.9 + q.ph) * 6;
q.p.setAttribute('d', `M${f1(q.x - s)},${f1(y + tip)}Q${f1(q.x - s / 2)},${f1(y - s / 2)} ${f1(q.x)},${f1(y)}Q${f1(q.x + s / 2)},${f1(y - s / 2)} ${f1(q.x + s)},${f1(y + tip)}`);
}
boat.setAttribute('transform', `translate(${f1(boatState.x)},${f1(-178 + Math.sin(t * 1.3) * 1.2)}) rotate(${f1(Math.sin(t * 1.1) * 2)}) scale(.8)`);
const so = clamp((v - 380) / 320, 0, 1) * 0.5;
for (const s of streaks) {
s.p.setAttribute('d', `M${f1(s.x)},${f1(s.y)}h${f1(s.len)}`);
s.p.setAttribute('opacity', (so * s.o).toFixed(2));
}
}
// things that drift on their own clocks
function moveExtras(dt) {
const v = S.v;
for (const q of gulls) {
q.x += (26 * q.sp - v * 0.08) * dt;
if (q.x < view.x0 - 60) { q.x = view.x1 + R(20, 300); q.y = R(-470, -300); }
}
boatState.x += (8 - v * 0.1) * dt;
if (boatState.x < view.x0 - 40) boatState.x = view.x1 + R(60, 500);
for (const s of streaks) {
s.x -= v * s.k * dt;
if (s.x + s.len < view.x0) { s.x = view.x1 + R(0, 400); s.y = R(-430, -20); s.len = R(60, 160); }
}
}
/* ---------- handlebar computer ---------- */
const lcd = $(‘lcd’);
const SEGS = { 0: ‘abcdef’, 1: ‘bc’, 2: ‘abdeg’, 3: ‘abcdg’, 4: ‘bcfg’, 5: ‘acdfg’, 6: ‘acdefg’, 7: ‘abc’, 8: ‘abcdefg’, 9: ‘abcdfg’, ’ ': ‘’ };
function segShapes(x, y, w, h, t) {
const g = t * 0.14, hh = h / 2, ht = t / 2;
const H = (x0, x1, c) => M${f1(x0)},${f1(c)}L${f1(x0 + ht)},${f1(c - ht)}L${f1(x1 - ht)},${f1(c - ht)}L${f1(x1)},${f1(c)}L${f1(x1 - ht)},${f1(c + ht)}L${f1(x0 + ht)},${f1(c + ht)}Z;
const V = (c, y0, y1) => M${f1(c)},${f1(y0)}L${f1(c + ht)},${f1(y0 + ht)}L${f1(c + ht)},${f1(y1 - ht)}L${f1(c)},${f1(y1)}L${f1(c - ht)},${f1(y1 - ht)}L${f1(c - ht)},${f1(y0 + ht)}Z;
const xl = x + ht, xr = x + w - ht;
return {
a: H(xl + g, xr - g, y + ht), g: H(xl + g, xr - g, y + hh), d: H(xl + g, xr - g, y + h - ht),
f: V(xl, y + ht + g, y + hh - g), b: V(xr, y + ht + g, y + hh - g),
e: V(xl, y + hh + g, y + h - ht - g), c: V(xr, y + hh + g, y + h - ht - g),
};
}
function segDisplay(x, y, w, h, t, pitch, n, dps) {
const grp = mk(‘g’, { transform: ‘skewX(-6)’ }, lcd);
const gap = t * 1.6, digits = , dots = {};
let cx = x;
for (let i = 0; i < n; i++) {
const shapes = segShapes(cx, y, w, h, t), segs = {};
for (const k in shapes) segs[k] = mk(‘path’, { d: shapes[k], class: ‘seg-off’ }, grp);
digits.push(segs);
if (dps.includes(i)) {
dots[i] = mk(‘circle’, { cx: f1(cx + w + (pitch - w + gap) / 2), cy: f1(y + h - t / 2), r: f1(t * 0.6), class: ‘seg-off’ }, grp);
cx += gap;
}
cx += pitch;
}
let last = ‘’;
return (str, dp) => {
const key = str + dp;
if (key === last) return;
last = key;
digits.forEach((segs, i) => {
const on = SEGS[str[i]] ?? ‘’;
for (const k in segs) segs[k].setAttribute(‘class’, on.includes(k) ? ‘seg-on’ : ‘seg-off’);
});
for (const i in dots) dots[i].setAttribute(‘class’, +i === dp ? ‘seg-on’ : ‘seg-off’);
};
}
const label = (x, y, s) => { mk(‘text’, { x, y }, lcd).textContent = s; };
label(9, 11, ‘SPD’); label(122, 68, ‘KM/H’);
label(161, 11, ‘CAD’); label(212, 11, ‘RPM’);
label(161, 51, ‘ODO’); label(219, 51, ‘KM’);
mk(‘path’, { d: ‘M152,6 V72’, ‘stroke-width’: 1, opacity: 0.25, style: ‘stroke:var(–lcd-ink)’ }, lcd);
const showSpeed = segDisplay(12, 16, 26, 50, 5.4, 33, 3, [1]);
const showCad = segDisplay(164, 15, 13, 22, 3, 16.5, 3, );
const showOdo = segDisplay(164, 55, 13, 20, 3, 16.5, 3, [0, 1]);
function updateHud() {
const kmh = S.v * KMH;
showSpeed(String(Math.round(kmh * 10)).padStart(2, ‘0’).padStart(3, ’ '), 1);
showCad(String(Math.round(cadence(S.v))).padStart(3, ’ '), -1);
const km = S.dist * KMH / 3600;
if (km < 10) showOdo(String(Math.floor(km * 100)).padStart(3, ‘0’), 0);
else showOdo(String(Math.floor(Math.min(km, 99.9) * 10)).padStart(3, ‘0’), 1);
}
/* ---------- controls ---------- */
const root = document.documentElement;
const gearsEl = $(‘gears’);
const gearBtns = GEARS.map((_, i) => {
const b = document.createElement(‘button’);
b.type = ‘button’; b.className = ‘gear’; b.id = gear${i + 1};
b.setAttribute(‘role’, ‘radio’);
b.setAttribute(‘aria-label’, ${i + 1} 档);
b.style.setProperty(‘–h’, ${8 + i * 3.4}px);
b.innerHTML = <i></i><span>${i + 1}</span>;
b.addEventListener(‘click’, () => setGear(i));
gearsEl.appendChild(b);
return b;
});
function setGear(i, focus) {
S.gear = clamp(i, 0, GEARS.length - 1);
gearBtns.forEach((b, k) => { b.setAttribute(‘aria-checked’, String(k === S.gear)); b.tabIndex = k === S.gear ? 0 : -1; });
if (focus) gearBtns[S.gear].focus();
}
gearsEl.addEventListener(‘keydown’, (e) => {
const d = { ArrowRight: 1, ArrowUp: 1, ArrowLeft: -1, ArrowDown: -1 }[e.key];
if (d) { setGear(S.gear + d, true); e.preventDefault(); e.stopPropagation(); }
});
const ICON = {
moon: ‘’,
sun: ‘’,
pause: ‘’,
play: ‘’,
};
const mqDark = matchMedia(‘(prefers-color-scheme: dark)’);
const isNight = () => (root.dataset.theme ? root.dataset.theme === ‘dark’ : mqDark.matches);
function syncTheme() {
const night = isNight();
el.btnTheme.innerHTML = (night ? ICON.sun : ICON.moon) + <span>${night ? '日骑' : '夜骑'}</span>;
el.btnTheme.setAttribute(‘aria-label’, night ? ‘切换到白天’ : ‘切换到夜晚’);
el.sub.textContent = night ? ‘月亮升起来了,车灯也亮了。’ : ‘沿着海岸公路,一直骑到日落。’;
}
const toggleTheme = () => { root.dataset.theme = isNight() ? ‘light’ : ‘dark’; syncTheme(); };
el.btnTheme.addEventListener(‘click’, toggleTheme);
mqDark.addEventListener(‘change’, syncTheme);
new MutationObserver(syncTheme).observe(root, { attributes: true, attributeFilter: [‘data-theme’] });
function setPaused(p) {
paused = p;
stage.classList.toggle(‘paused’, p);
el.btnPause.innerHTML = (p ? ICON.play : ICON.pause) + <span>${p ? '继续' : '暂停'}</span>;
}
el.btnPause.addEventListener(‘click’, () => setPaused(!paused));
addEventListener(‘keydown’, (e) => {
if (e.altKey || e.ctrlKey || e.metaKey) return;
const onButton = e.target instanceof HTMLButtonElement;
if (e.key === ‘ArrowRight’ || e.key === ‘ArrowUp’) { setGear(S.gear + 1); e.preventDefault(); }
else if (e.key === ‘ArrowLeft’ || e.key === ‘ArrowDown’) { setGear(S.gear - 1); e.preventDefault(); }
else if (e.key === ’ ’ && !onButton) { setPaused(!paused); e.preventDefault(); }
else if (e.key === ‘n’ || e.key === ‘N’) toggleTheme();
});
/* ---------- boot ---------- */
fit();
let fitQueued = false;
new ResizeObserver(() => {
if (fitQueued) return;
fitQueued = true;
requestAnimationFrame(() => { fitQueued = false; fit(); render(); });
}).observe(stage);
setGear(S.gear);
syncTheme();
for (let i = 0; i < 90; i++) simulate(1 / 60); // let the scarf settle into the wind
moveExtras(0);
render();
updateHud();
setPaused(matchMedia(‘(prefers-reduced-motion: reduce)’).matches);
let last = performance.now();
function frame(now) {
const dt = Math.min(0.05, (now - last) / 1000);
last = now;
if (!paused && dt > 0) {
simulate(dt);
moveExtras(dt);
render();
if (S.t >= S.hudAt) { updateHud(); S.hudAt = S.t + 0.2; }
}
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
})();
-
hanshine 09-23 23:231楼我的any怎么这样子明显降智


- ↑关于沉**翻译是否过于离谱,还是我太过抠门
- ↑(已失效)新GPT暗号:“缇宝给你打工一个月”
- ↑如何进行好的Code Review,有没有什么核心的方法论
- ↑最近都是鹈鹕,试试鹈鹕兄弟的成色 :bili_040:
- ↑【前沿快讯】📢 [OpenRouter] 新免费匿名模型上线:stealth/space-bunny-alpha
- 📍 Claude Code + Opus5.5 MAX | 2D鹈鹕
- ↓Tailscale 算 VPN 吗?
- ↓gg卡也退款了,搞了张乌龟卡和banana
- ↓开个claude pro,看看多久封
- ↓2500左右平板推荐
- ↓(已解决)zotero看文献翻译即使用ds 4.1也有点慢