Deploy dist

This commit is contained in:
hermes committed 2026-12-03 23:00:48 +00:00
commit 39462fa01c
5 files changed
+84

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=`https://advent-of-slop.quesma.com`,t=`
nav {
position: fixed;
top: 0;
right: 0;
z-index: 2147483647;
display: flex;
flex-wrap: wrap;
gap: 0 0.35em;
max-width: 100vw;
box-sizing: border-box;
padding: 0.35rem 0.7rem;
border-bottom-left-radius: 0.5rem;
background: #b8232f;
font: 700 0.8125rem/1.2 system-ui, sans-serif;
}
a {
color: #f6ecd6;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
`,n=(e,t)=>{let n=document.createElement(`a`);return n.href=e,n.textContent=t,n},r=class extends HTMLElement{connectedCallback(){let r=Number(this.getAttribute(`day`));if(!Number.isInteger(r)||r<1||r>24)throw Error(`<advent-badge> needs day="1" to day="24", got ${this.getAttribute(`day`)}`);let i=this.getAttribute(`name`);if(i===null||i.trim()===``)throw Error(`<advent-badge> needs name="...", the title of its day, such as name="Living fishtank"`);let a=document.createElement(`style`);a.textContent=t;let o=document.createElement(`nav`);o.append(n(`${e}/`,`Advent of AI Slop`),n(`${e}/day/${r}/`,`[Day ${r}] ${i}`)),this.attachShadow({mode:`open`}).append(a,o)}};customElements.define(`advent-badge`,r);var i=[150,350,600,900,1300],a=72;function o(e){return e.cy+.62*e.r}function s(e){let t=o(e)-e.cy;return Math.sqrt(Math.max(0,e.r*e.r-t*t))}var c=class{flakes=[];drift=new Float32Array(a);target=i[1];g;constructor(e){this.g=e}resize(e){this.g=e}maxDrift(){return .3*this.g.r}driftAt(e){let t=this.g,n=s(t),r=(e-(t.cx-n))/(2*n);if(r<0||r>1)return 0;let i=Math.min(71,Math.floor(r*a));return this.drift[i]??0}driftDepthCm(){let e=0;for(let t of this.drift)e+=t;return e/a/this.g.r*30}serializeDrift(){return Array.from(this.drift,e=>Math.round(e*100)/100)}loadDrift(e){if(e.length!==a)return;let t=this.maxDrift();for(let n=0;n<a;n++)this.drift[n]=Math.min(t,Math.max(0,e[n]??0))}sweep(){this.drift.fill(0)}spawn(e){let t=this.g,n=Math.random()*Math.PI*2,r=Math.sqrt(Math.random())*(t.r*.92),i=e?t.cy+Math.random()*t.r*.5:t.cy-t.r+Math.random()*t.r*.6;this.flakes.push({x:t.cx+Math.cos(n)*r,y:i,vx:(Math.random()-.5)*.05*t.r,vy:Math.random()*.05*t.r,r:t.r*(.004+Math.random()*.008),phase:Math.random()*Math.PI*2,alpha:.55+Math.random()*.45})}shake(e){let t=e*this.g.r;for(let e of this.flakes)e.vx+=(Math.random()-.5)*1.4*t,e.vy+=(Math.random()-.9)*1.2*t;let n=.05*e;for(let e=0;e<a;e++){let t=this.drift[e]??0,r=t*n;this.drift[e]=t-r}}puff(e,t){let n=this.g;for(let r=0;r<26&&!(this.flakes.length>=this.target+60);r++){let r=-Math.PI/2+(Math.random()-.5)*1.6,i=n.r*(.2+Math.random()*.5);this.flakes.push({x:e,y:t,vx:Math.cos(r)*i,vy:Math.sin(r)*i,r:n.r*(.004+Math.random()*.007),phase:Math.random()*Math.PI*2,alpha:.7+Math.random()*.3})}}update(e){let t=this.g,n=.3*t.r,r=.35*t.r,i=t.r-3,c=s(t),l=t.cx-c,u=this.maxDrift();if(this.flakes.length<this.target){let e=Math.min(6,this.target-this.flakes.length);for(let t=0;t<e;t++)this.spawn(!1)}else this.flakes.length>this.target+80&&this.flakes.splice(0,this.flakes.length-this.target);let d=[];for(let s of this.flakes){s.vy+=n*e,s.phase+=2.2*e,s.vx+=Math.sin(s.phase)*r*e;let f=Math.max(0,1-1.4*e);s.vx*=f,s.vy*=f,s.x+=s.vx*e,s.y+=s.vy*e;let p=s.x-t.cx,m=s.y-t.cy,h=Math.hypot(p,m);if(h>i-s.r){let e=p/h,n=m/h;s.x=t.cx+e*(i-s.r),s.y=t.cy+n*(i-s.r);let r=s.vx*e+s.vy*n;r>0&&(s.vx-=1.35*r*e,s.vy-=1.35*r*n)}let g=(s.x-l)/(2*c);if(g>=0&&g<=1){let e=Math.min(71,Math.floor(g*a)),n=o(t)-(this.drift[e]??0);if(s.y>=n-s.r*.5){let t=this.drift[e]??0;this.drift[e]=Math.min(u,t+s.r*.32);let n=this.drift[Math.max(0,e-1)]??0,r=this.drift[Math.min(71,e+1)]??0,i=(n+r)/2;t-i>this.g.r*.012&&(this.drift[e]=t-(t-i)*.25,e>0&&(this.drift[e-1]=n+(t-i)*.125),e<71&&(this.drift[e+1]=r+(t-i)*.125));continue}}else if(s.y>o(t))continue;d.push(s)}this.flakes=d}};function l(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}var u=[`#c8503f`,`#d9a441`,`#4a7fa5`,`#7a9b64`,`#b5651d`,`#a63d5a`,`#c9b458`,`#3f6d8e`,`#d07a4a`,`#8a5a83`,`#c05a4a`,`#5d8a68`,`#caa06a`,`#456b93`];function d(e=1864){let t=l(e),n=[],r=.015;for(;r<.985;){let e=.055+t()*.045;if(r+e>.99)break;let i=t(),a=2+Math.floor(t()*2),o=2+Math.floor(t()*3),s=[];for(let e=0;e<a*o;e++)s.push(t()<.62);n.push({x:r+e/2,w:e,h:.24+t()*.16,color:u[Math.floor(t()*u.length)]??`#c8503f`,gable:i<.45?`tri`:i<.85?`step`:`flat`,cols:a,rows:o,lit:s,crane:t()<.16}),r+=e+.004}let i=[.14,.38,.62,.86],a=[],o=[`#2b3a55`,`#5a2b2b`,`#2f4a3a`,`#4a3a5a`,`#1f2937`,`#6b4a2f`];for(let e=0;e<7;e++)a.push({x:t(),speed:.012+t()*.02,dir:t()<.5?1:-1,h:.05+t()*.018,coat:o[Math.floor(t()*o.length)]??`#2b3a55`});return{houses:n,lamps:i,people:a}}var f={day:{skyTop:`#8fb4d4`,skyBottom:`#dcebf4`,far:`#93a9bd`,water:`#3c5f7a`,quay:`#cfd9e2`,snow:`#ffffff`,snowShade:`#dfe7f0`,lit:!1,stars:!1,glow:`rgba(255,220,140,0)`},dusk:{skyTop:`#3d3a68`,skyBottom:`#e8935a`,far:`#5b5378`,water:`#3a3a63`,quay:`#b9a9b8`,snow:`#f4e9ec`,snowShade:`#d8c4cf`,lit:!0,stars:!1,glow:`rgba(255,190,110,0.55)`},night:{skyTop:`#0a142e`,skyBottom:`#20375e`,far:`#2c4060`,water:`#12203c`,quay:`#5f7392`,snow:`#dbe6f5`,snowShade:`#b9c9e0`,lit:!0,stars:!0,glow:`rgba(255,205,130,0.7)`}};function p(e,t,n,r){let i=f[n],a=e.createLinearGradient(0,t.cy-t.r,0,t.cy+t.r);if(a.addColorStop(0,i.skyTop),a.addColorStop(1,i.skyBottom),e.fillStyle=a,e.fillRect(t.cx-t.r,t.cy-t.r,t.r*2,t.r*2),i.stars){let n=l(7);e.fillStyle=`rgba(255,255,255,0.9)`;for(let i=0;i<40;i++){l Line truncated
<header>
<h1>Københavnerkuglen</h1>
<p class="sub">A snow globe of Copenhagen. Grab it and <em>shake</em> it — or just hit the button.</p>
</header>
<div id="stage">
<canvas id="globe" aria-label="A snow globe of Copenhagen's Nyhavn with falling snow"></canvas>
</div>
<div id="hud">
<span id="stat-drift" class="stat"></span>
<span id="stat-flakes" class="stat"></span>
<span id="stat-shakes" class="stat"></span>
</div>
<div id="controls">
<button id="shake-btn" type="button">🌨️ Ryst den!</button>
<label class="ctl">Sne
<input id="density" type="range" min="0" max="4" step="1" />
</label>
<div class="ctl themes" role="group" aria-label="Time of day">
<button type="button" data-theme="day">Dag</button>
<button type="button" data-theme="dusk">Aften</button>
<button type="button" data-theme="night">Nat</button>
</div>
<button id="sweep-btn" type="button" title="Shovel the drift away">🧹 Fej snescooten</button>
</div>
<p class="hint">Tip: click the drift for a puff, or press <kbd>space</kbd> to shake.</p>
`;var S=document.getElementById(`globe`),C=S.getContext(`2d`);if(!C)throw Error(`no 2d context`);var w=document.getElementById(`stat-drift`),T=document.getElementById(`stat-flakes`),E=document.getElementById(`stat-shakes`),ee=document.getElementById(`shake-btn`),D=document.getElementById(`sweep-btn`),O=document.getElementById(`density`),k=Array.from(document.querySelectorAll(`#controls .themes button`)),A=b(),j=A.theme,M=A.shakes,N=d(),P=new c({cx:0,cy:0,r:1});P.target=i[A.density]??i[1],O.value=String(A.density);var F={cx:0,cy:0,r:1},I=1;function L(){let e=document.getElementById(`stage`),t=Math.min(e.clientWidth,620);I=window.devicePixelRatio||1,S.width=Math.round(t*I),S.height=Math.round(t*1.12*I),S.style.width=`${t}px`,S.style.height=`${t*1.12}px`,F={cx:t*I/2,cy:t*I*1.12/2-t*I*.02,r:t*I*.42},P.resize(F)}L(),A.drift.length>0&&P.loadDrift(A.drift),window.addEventListener(`resize`,L);var R=0,z=0;function B(e){let t=Math.min(1,e);R=Math.max(R,F.r*.055*t),P.shake(t),M+=1,Y()}var V=!1,H=0,U=0,W=0,G=[],K=!1;S.addEventListener(`pointerdown`,e=>{V=!0,K=!1,H=e.clientX,U=performance.now(),W=0,G=[],S.setPointerCapture(e.pointerId)}),S.addEventListener(`pointermove`,e=>{if(!V)return;let t=performance.now(),n=Math.max(1,t-U)/1e3,r=(e.clientX-H)/n;Math.abs(e.clientX-H)>2&&(K=!0),Math.abs(r)>F.r*1.2&&Math.sign(r)!==Math.sign(W)&&W!==0&&(G.push(t),G=G.filter(e=>t-e<700),G.length>=2&&(B(.45+.55*Math.min(1,Math.abs(r)/(F.r*6))),G=[])),Math.abs(r)>20&&(W=r),H=e.clientX,U=t}),S.addEventListener(`pointerup`,e=>{if(V=!1,!K){let t=S.getBoundingClientRect(),n=(e.clientX-t.left)*I,r=(e.clientY-t.top)*I;Math.hypot(n-F.cx,r-F.cy)<F.r*.95&&P.puff(n,r)}}),ee.addEventListener(`click`,()=>B(.9)),window.addEventListener(`keydown`,e=>{e.code===`Space`&&!(e.target instanceof HTMLButtonElement)&&(e.preventDefault(),B(.85))}),D.addEventListener(`click`,()=>{P.sweep(),Y()}),O.addEventListener(`input`,()=>{P.target=i[Number(O.value)]??i[1],Y()});for(let e of k)e.addEventListener(`click`,()=>{let t=e.dataset.theme;(t===`day`||t===`dusk`||t===`night`)&&(j=t,q(),Y())});function q(){for(let e of k)e.classList.toggle(`active`,e.dataset.theme===j)}q();var J=0;function Y(){window.clearTimeout(J),J=window.setTimeout(X,400)}function X(){let e={density:Number(O.value),theme:j,drift:P.serializeDrift(),shakes:M};try{localStorage.setItem(y,JSON.stringify(e))}catch{}}window.addEventListener(`beforeunload`,X),window.setInterval(X,1e4);function te(){let{cx:e,cy:t,r:n}=F,r=t+n*.78,i=n*.62,a=n*.95,o=n*.34,s=C.createLinearGradient(e-i,0,e+i,0);s.addColorStop(0,`#7a5c2e`),s.addColorStop(.5,`#d9b45f`),s.addColorStop(1,`#7a5c2e`),C.fillStyle=s,C.beginPath(),C.moveTo(e-i,r),C.lineTo(e+i,r),C.lineTo(e+i*1.06,r+n*.07),C.lineTo(e-i*1.06,r+n*.07),C.closePath(),C.fill();let c=C.createLinearGradient(e-a,0,e+a,0);c.addColorStop(0,`#3a2417`),c.addColorStop(.5,`#6b4226`),c.addColorStop(1,`#3a2417`),C.fillStyle=c,C.beginPath(),C.moveTo(e-i*1.06,r+n*.07),C.lineTo(e+i*1.06,r+n*.07),C.lineTo(e+a,r+o),C.lineTo(e-a,r+o),C.closePath(),C.fill(),C.fillStyle=`#caa95c`;let l=n*.42,u=n*.085,d=r+o*.52;C.beginPath(),C.roundRect(e-l/2,d-u/2,l,u,u*.3),C.fill(),C.fillStyle=`#3a2417`,C.font=`700 ${Math.round(u*.52)}px system-ui, sans-serif`,C.textAlign=`center`,C.textBaseline=`middle`,C.fillText(`KØBENHAVN`,e,d+u*.04)}function ne(){let{cx:e,cy:t,r:n}=F;C.lineWidth=Math.max(2,n*.014),C.strokeStyle=`rgba(210,225,240,0.5)`,C.beginPath(),C.arc(e,t,n,0,Math.PI*2),C.stroke(),C.save(),C.beginPath(),C.arc(e,t,n,0,Math.PI*2),C.clip();let r=C.createLinearGradient(e-n,t-n,e-n*.2,t+n*.2);r.addColorStop(0,`rgba(255,255,255,0.34)`),r.addColorStop(.5,`rgba(255,255,255,0.06)`),r.addColorStop(1,`rgba(255,255,255,0)`),C.fillStyle=r,C.fillRect(e-n,t-n,n*2,n*2),C.fillStyle=`rgba(255,255,255,0.5)`,C.beginPath(),C.ellipse(e-n*.45,t-n*.55,n*.1,n*.05,-.7,0,Math.PI*2),C.fill();let i=C.createRadialGradient(e,t,n*.75,e,t,n);i.addColorStop(0,`rgba(20,30,50,0)`),i.addColorStop(1,`rgba(20,30,50,0.28)`),C.fillStyle=i,C.fillRect(e-n,t-n,n*2,n*2),C.restore()}var Z=performance.now(),Q=0;function $(e){let t=Math.min(.033,(e-Z)/1e3);Z=e,Q+=t;let n=0,r=0;R>.5?(z+=t*34,R*=Math.exp(-t*3.2),n=Math.sin(z)*R,r=Math.sin(z*.8+1.2)*R*.35):R=0;for(let e of N.people)e.x+=e.speed*e.dir*t,e.x>.99&&(e.dir=-1),e.x<.01&&(e.dir=1);P.update(t);let i=S.width,a=S.height;C.clearRect(0,0,i,a),C.save(),C.translate(n,r),C.save(),C.beginPath(),C.arc(F.cx,F.cy,F.r,0,Math.PI*2),C.clip(),p(C,F,j,Q),m(C,F,j),v(C,F,j),h(C,F,j,N,e=>P.driftAt(e)),g(C,F,N,e=>P.driftAt(e),Q),_(C,F,j,e=>P.driftAt(e)),C.fillStyle=j===`night`?`#e8f0fb`:`#ffffff`;for(let e of P.flakes)C.globalAlpha=e.alpha,C.beginPath(),C.arc(e.x,e.y,e.r,0,Math.PI*2),C.fill();C.globalAlpha=1,C.restore(),ne(),te(),C.restore(),w.textContent=`drift: ${P.driftDepthCm().toFixed(1)} cm`,T.textContent=`flakes: ${P.flakes.length}`,E.textContent=`shakes: ${M}${M>=100?` 💪`:``}`,requestAnimationFrame($)}requestAnimationFrame($);
+1
View File
@@ -0,0 +1 @@
:root{--bg:#0d1626;--panel:#16233a;--ink:#e8eef7;--muted:#93a6c0;--accent:#d9b45f}*{box-sizing:border-box}body{background:radial-gradient(1200px 700px at 50% -10%, #1b2c49 0%, var(--bg) 60%), var(--bg);min-height:100vh;color:var(--ink);justify-content:center;margin:0;padding:1.2rem 1rem 3rem;font:16px/1.5 system-ui,-apple-system,Segoe UI,sans-serif;display:flex}#app{text-align:center;width:min(680px,100%)}header h1{letter-spacing:.02em;margin:.4rem 0 .1rem;font-size:clamp(1.7rem,5vw,2.5rem)}header .sub{color:var(--muted);margin:0 0 .8rem}#stage{justify-content:center;display:flex}canvas{cursor:grab;touch-action:none;max-width:100%;display:block}canvas:active{cursor:grabbing}#hud{flex-wrap:wrap;justify-content:center;gap:1.2rem;margin:.2rem 0 .7rem;display:flex}.stat{color:var(--muted);font-variant-numeric:tabular-nums;font-size:.85rem}#controls{background:var(--panel);border:1px solid #24344f;border-radius:14px;flex-wrap:wrap;justify-content:center;align-items:center;gap:.8rem;width:fit-content;margin:0 auto;padding:.7rem 1rem;display:flex}#controls button{color:var(--ink);cursor:pointer;background:#223554;border:1px solid #33507e;border-radius:10px;padding:.45rem .9rem;font:600 .9rem system-ui,sans-serif}#controls button:hover{background:#2c4468}#shake-btn{background:#b8232f!important;border-color:#d4404c!important}#shake-btn:hover{background:#cf2e3b!important}.ctl{color:var(--muted);align-items:center;gap:.5rem;font-size:.85rem;display:flex}input[type=range]{accent-color:var(--accent);width:110px}.themes{gap:.35rem}.themes button.active{background:var(--accent);border-color:var(--accent);color:#241a08}.hint{color:var(--muted);margin-top:.8rem;font-size:.8rem}kbd{background:#223554;border:1px solid #33507e;border-radius:4px;padding:.05rem .35rem;font-size:.75rem}
+10
View File
@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<circle cx="32" cy="27" r="22" fill="#bfe0f2" stroke="#e8f4fb" stroke-width="3"/>
<rect x="18" y="46" width="28" height="10" rx="3" fill="#6b4226"/>
<rect x="16" y="44" width="32" height="5" rx="2" fill="#d9b45f"/>
<circle cx="24" cy="20" r="2" fill="#fff"/>
<circle cx="36" cy="16" r="2" fill="#fff"/>
<circle cx="42" cy="26" r="2" fill="#fff"/>
<circle cx="28" cy="30" r="2" fill="#fff"/>
<path d="M20 40 Q32 32 44 40 L44 44 L20 44 Z" fill="#fff"/>
</svg>

After

Width:  |  Height:  |  Size: 535 B

+23
View File
@@ -0,0 +1,23 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="./favicon.svg" type="image/svg+xml" />
<title>Københavnerkuglen — Advent of AI Slop Day 3</title>
<meta name="description" content="A snow globe of Copenhagen you can actually shake. Nyhavn in a blizzard, spiral spires under snow, and a snowdrift that keeps growing. Made for Advent of AI Slop Day 3." />
<meta property="og:type" content="website" />
<meta property="og:title" content="Københavnerkuglen — Advent of AI Slop Day 3" />
<meta property="og:description" content="A snow globe of Copenhagen you can actually shake. Grab it, rattle it, watch Nyhavn disappear under the drift." />
<meta property="og:url" content="https://pages.obahan.xyz/lullu/advent-of-slop-03-copenhagen-snow-globe/" />
<meta property="og:image" content="https://pages.obahan.xyz/lullu/advent-of-slop-03-copenhagen-snow-globe/preview.png" />
<meta name="twitter:card" content="summary_large_image" />
<script type="module" crossorigin src="./assets/index-B6U23M2C.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-m7o_ROt7.css">
</head>
<body>
<!-- day: the day of December this was made for, 1 to 24. name: the title of that day. -->
<advent-badge day="3" name="Snow globe"></advent-badge>
<main id="app"></main>
</body>
</html>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB