publish fishtank site

This commit is contained in:
hermes committed 2026-12-02 08:31:49 +00:00
commit bd786a6cb4
3 files changed
+102

No files matched your search

+80
View File
@@ -0,0 +1,80 @@
(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=`
a {
position: fixed;
top: 0;
right: 0;
z-index: 2147483647;
padding: 0.35rem 0.7rem;
border-bottom-left-radius: 0.5rem;
background: #b8232f;
color: #f6ecd6;
font: 700 0.8125rem/1.2 system-ui, sans-serif;
text-decoration: none;
}
a:hover {
background: #0f3b2d;
}
`,n=class extends HTMLElement{connectedCallback(){let n=Number(this.getAttribute(`day`));if(!Number.isInteger(n)||n<1||n>24)throw Error(`<advent-badge> needs day="1" to day="24", got ${this.getAttribute(`day`)}`);let r=document.createElement(`style`);r.textContent=t;let i=document.createElement(`a`);i.href=`${e}/day/${n}/`,i.textContent=`Advent of AI Slop`,i.title=`Made for day ${n} of Advent of AI Slop`,this.attachShadow({mode:`open`}).append(r,i)}};customElements.define(`advent-badge`,n);var r=document.querySelector(`#app`);if(r===null)throw Error(`Missing #app in index.html`);r.innerHTML=`
<div class="tank-wrap">
<canvas id="tank"></canvas>
<div class="hud">
<span id="count">0 fish</span>
<button id="feed" type="button">Feed the fish</button>
</div>
<p id="hint" class="hint" hidden>Draw a fish on the right, then press <b>Release into the tank</b> — or click the water to drop food.</p>
</div>
<aside id="panel" class="panel open">
<button id="toggle" class="toggle" type="button" title="Show or hide the studio">🎨 Fish studio</button>
<div class="panel-body">
<canvas id="studio" width="320" height="220"></canvas>
<div class="row swatches" id="swatches"></div>
<div class="row tools">
<label class="size">Brush <input id="brush" type="range" min="3" max="40" value="14"></label>
<button id="eraser" type="button" title="Erase">⌫</button>
<button id="undo" type="button" title="Undo">↩︎</button>
<button id="clear" type="button" title="Clear">🗑</button>
</div>
<div class="row actions">
<button id="release" class="primary" type="button">Release into the tank</button>
<button id="random" type="button" title="Generate a random fish">🎲 Random fish</button>
</div>
</div>
</aside>
`;var i=document.createElement(`style`);i.textContent=`
:root { color-scheme: dark; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #06222e;
font: 15px/1.4 system-ui, sans-serif; color: #e8f4f2; }
#app { height: 100%; position: relative; }
.tank-wrap { position: absolute; inset: 0; }
#tank { width: 100%; height: 100%; display: block; cursor: crosshair; }
.hud { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 10px; align-items: center; }
.hud span { font-size: .85rem; opacity: .75; }
.hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
margin: 0; padding: .5rem .9rem; border-radius: .6rem; background: rgba(4,20,28,.72);
backdrop-filter: blur(6px); font-size: .9rem; }
button { font: inherit; border: 1px solid rgba(255,255,255,.18); border-radius: .55rem;
background: rgba(9,42,56,.8); color: #e8f4f2; padding: .35rem .8rem; cursor: pointer; }
button:hover { background: rgba(16,64,84,.9); }
button.primary { background: #b8232f; border-color: #d45660; font-weight: 700; }
button.primary:hover { background: #d0303e; }
button.primary:disabled { opacity: .45; cursor: default; }
button.on { background: #0f3b2d; border-color: #3f8f74; }
.panel { position: absolute; top: 0; right: 0; height: 100%; z-index: 5;
transform: translateX(calc(100% - 2.6rem)); transition: transform .25s ease; }
.panel.open { transform: translateX(0); }
.toggle { position: absolute; left: -2.6rem; top: 50%; transform: translateY(-50%);
writing-mode: vertical-rl; border-radius: .55rem 0 0 .55rem; padding: .7rem .45rem; z-index: 6; }
.panel.open .toggle { writing-mode: horizontal-tb; left: -3.4rem; right: auto; top: 12px;
transform: none; border-radius: .55rem 0 0 .55rem; }
.panel-body { height: 100%; box-sizing: border-box; padding: 52px 14px 14px;
width: 348px; background: rgba(6,28,38,.88); backdrop-filter: blur(10px);
border-left: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; gap: 10px; }
#studio { width: 100%; aspect-ratio: 320/220; border-radius: .6rem; touch-action: none;
background: #dcece6; border: 1px solid rgba(255,255,255,.2); cursor: crosshair; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; padding: 0; border-radius: 50%; }
.swatches button.sel { outline: 2px solid #fff; }
.size { display: flex; gap: 6px; align-items: center; font-size: .85rem; flex: 1; }
.size input { flex: 1; accent-color: #b8232f; }
@media (max-width: 720px) { .panel-body { width: min(348px, 92vw); } }
`,document.head.append(i);var a=document.getElementById(`tank`),o=a.getContext(`2d`),s=document.getElementById(`count`),c=document.getElementById(`hint`),l=0,u=0,d=1;function f(){d=Math.min(window.devicePixelRatio||1,2),l=a.clientWidth,u=a.clientHeight,a.width=Math.round(l*d),a.height=Math.round(u*d),o.setTransform(d,0,0,d,0,0)}window.addEventListener(`resize`,f),f();var p=[],m=[],h=[],g=()=>u-Math.max(46,u*.09),_=[],v=[];function y(){_=[],v=[];let e=Math.max(4,Math.round(l/220));for(let t=0;t<e;t++)_.push({x:30+Math.random()*(l-60),h:60+Math.random()*160,hue:95+Math.random()*60,sway:.5+Math.random()});for(let e=0;e<26;e++)v.push({x:Math.random()*l,y:g()+8+Math.random()*(u-g()-14),r:2+Math.random()*5,g:90+Math.random()*60})}y(),window.addEventListener(`resize`,y);function b(e,t){let n=.55+Math.random()*.45,r=e.scale*(.75+n*.45),i=60+Math.random()*Math.max(60,g()-120),a={img:t,x:Math.random()*l,y:i,vx:0,vy:0,facing:Math.random()<.5?1:-1,speed:(26+Math.random()*40)*(1.15-n*.35),scale:r,phase:Math.random()*Math.PI*2,tx:Math.random()*l,ty:i,retarget:0,depth:n};p.push(a),j(),k()}function x(e,t,n){e.retarget-=t;let r=e.tx,i=e.ty,a=null,o=1e9;for(let t of m){let n=Math.hypot(t.x-e.x,t.y-e.y);n<o&&(o=n,a=t)}a!==null&&o<Math.min(l,u)*.6?(r=a.x,i=a.y):e.retarget<=0&&(e.retarget=3+Math.random()*5,e.tx=40+Math.random()*Math.max(60,l-80),e.ty=50+Math.random()*Math.max(60,g()-110));let s=r-e.x,c=i-e.y,d=Math.hypot(s,c)||1,f=s/d*e.speed,p=c/d*e.speed*.6;e.vx+=(f-e.vx)*Math.min(1,t*1.4),e.vy+=(p-e.vy+Math.sin(n*1.7+e.phase)*6)*Math.min(1,t*1.4),Math.abs(e.vx)>4&&(e.facing=e.vx>0?1:-1),e.x+=e.vx*t,e.y+=e.vy*t,e.x=Math.max(20,Math.min(l-20,e.x)),e.y=Math.max(30,Math.min(g()-14,e.y));for(let t=m.length-1;t>=0;t--){let n=m[t];if(Math.hypot(n.x-e.x,n.y-e.y)<26*e.scale+6){m.splice(t,1);for(let e=0;e<3;e++)h.push({x:n.x,y:n.y,r:1.5+Math.random()*2,vy:40+Math.random()*30,wob:Math.random()*6})}}}function S(e,t){let n=e.img,r=n.naturalWidth*e.scale,i=n.naturalHeight*e.scale,a=n.naturalWidth/14,s=.1+.16*Math.min(1,Math.hypot(e.vx,e.vy)/e.speed),c=Math.atan2(e.vy,Math.abs(e.vx)+1)*.55;o.save(),o.translate(e.x,e.y),o.rotate(e.facing===1?c:-c),o.scale(e.facing,1),o.globalAlpha=.55+e.depth*.45;let l=1+.02*Math.sin(t*6+e.phase);o.scale(l,1);for(let c=0;c<14;c++){let l=c/13,u=Math.sin(t*7+e.phase-c*.55)*s*i*l*l;o.drawImage(n,c*a,0,a+.6,n.naturalHeight,-r/2+r/14*c,u-i/2,r/14+.6,i)}o.restore()}function C(e){let t=o.createLinearGradient(0,0,0,u);t.addColorStop(0,`#0d4f66`),t.addColorStop(.55,`#0a3a4e`),t.addColorStop(1,`#06222e`),o.fillStyle=t,o.fillRect(0,0,l,u),o.save(),o.globalCompositeOperation=`soft-light`;for(let t=0;t<5;t++){let n=l*(.1+.2*t)+Math.sin(e*.3+t*2.1)*l*.12,r=u*.25+Math.cos(e*.23+t*1.7)*u*.15,i=Math.min(l,u)*(.25+.1*Math.sin(e*.4+t)),a=o.createRadialGradient(n,r,0,n,r,i);a.addColorStop(0,`rgba(190,255,240,0.5)`),a.addColorStop(1,`rgba(190,255,240,0)`),o.fillStyle=a,o.fillRect(0,0,l,u)}o.restore();let n=g();for(let t of _){o.strokeStyle=`hsl(${t.hue} 45% 30%)`,o.lineCap=`round`;for(let r=0;r<3;r++){o.lineWidth=7-r*2;let i=Math.sin(e*t.sway+r*1.3)*14;o.beginPath(),o.moveTo(t.x+r*6,n+6),o.quadraticCurveTo(t.x+r*6+i*.5,n-t.h*.6,t.x+r*6+i,n-t.h*(.7+r*.12)),o.stroke()}}o.fillStyle=`#c9b283`,o.beginPath(),o.moveTo(0,u),o.lineTo(0,n+6);for(let e=0;e<=l;e+=40)o.lineTo(e,n+6+Math.sin(e*.02+2)*5);o.lineTo(l,u),o.closePath(),o.fill();for(let e of v)o.fillStyle=`rgb(${e.g+40},${e.g+30},${e.g+20})`,o.beginPath(),o.ellipse(e.x,e.y,e.r,e.r*.7,0,0,Math.PI*2),o.fill()}function w(e){Math.random()<e*1.2&&h.push({x:30+Math.random()*(l-60),y:g(),r:2+Math.random()*4,vy:35+Math.random()*35,wob:Math.random()*6}),o.strokeStyle=`rgba(220,250,255,0.5)`,o.lineWidth=1.2;for(let t=h.length-1;t>=0;t--){let n=h[t];n.y-=n.vy*e,n.x+=Math.sin(n.y*.05+n.wob)*12*e,n.y<8?h.splice(t,1):(o.beginPath(),o.arc(n.x,n.y,n.r,0,Math.PI*2),o.stroke())}}function T(e){o.fillStyle=`#8a5a2b`;for(let t of m)t.vy=Math.min(60,t.vy+60*e),t.y+=t.vy*e,t.x+=t.vx*e,t.vx*=1-e,t.y>g()+2&&(t.y=g()+2,t.vy=0),o.beginPath(),o.arc(t.x,t.y,3,0,Math.PI*2),o.fill()}var E=performance.now();function D(e){let t=Math.min(.05,(e-E)/1e3),n=e/1e3;E=e,C(n),T(t);let r=[...p].sort((e,t)=>e.depth-t.depth);for(let e of r)x(e,t,n),S(e,n);w(t),requestAnimationFrame(D)}requestAnimationFrame(D),document.getElementById(`feed`).addEventListener(`click`,()=>O(l/2,40)),a.addEventListener(`pointerdown`,e=>{let t=a.getBoundingClientRect();O(e.clientX-t.left,e.clientY-t.top)});function O(e,t){for(let n=0;n<7;n++)m.push({x:e+(Math.random()-.5)*46,y:t-Math.random()*20,vy:10+Math.random()*20,vx:(Math.random()-.5)*20})}function k(){s.textContent=`${p.length} ${p.length,`fish`}`,c.hidden=p.length>0}var A=`aos-01-living-fishtank`;function j(){try{localStorage.setItem(A,JSON.stringify(M))}catch{}}var M=[];function N(){try{let e=localStorage.getItem(A);if(!e)return;M=JSON.parse(e)}catch{M=[]}for(let e of M.slice(0,40)){let t=new Image;t.onload=()=>b(e,t),t.src=e.src}}var P=document.getElementById(`panel`);document.getEleme Line truncated