commit bd786a6cb456e0ab0af6db9be9536acc5c9a85e9 Author: hermes Date: Wed Dec 2 08:31:49 2026 +0000 publish fishtank site diff --git a/assets/index-B7g8QOqc.js b/assets/index-B7g8QOqc.js new file mode 100644 index 0000000..52d77c2 --- /dev/null +++ b/assets/index-B7g8QOqc.js @@ -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(` 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=` +
+ +
+ 0 fish + +
+ +
+ +`;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;t4&&(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()=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.getElementById(`toggle`).addEventListener(`click`,()=>P.classList.toggle(`open`));var F=document.getElementById(`studio`),I=F.getContext(`2d`,{willReadFrequently:!0}),L=document.getElementById(`release`),R=[`#e4572e`,`#f3a712`,`#d6409f`,`#2e86ab`,`#3aa76d`,`#f6f7fb`,`#2b2d42`,`#8d5524`],z=document.getElementById(`swatches`),B=R[0]??`#e4572e`,V=!1,H=14;R.forEach((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.style.background=e,n.title=e,t===0&&n.classList.add(`sel`),n.addEventListener(`click`,()=>{B=e,V=!1,z.querySelector(`.sel`)?.classList.remove(`sel`),n.classList.add(`sel`),document.getElementById(`eraser`).classList.remove(`on`)}),z.append(n)}),document.getElementById(`brush`).addEventListener(`input`,e=>{H=Number(e.target.value)});var U=document.getElementById(`eraser`);U.addEventListener(`click`,()=>{V=!V,U.classList.toggle(`on`,V)});var W=[];document.getElementById(`undo`).addEventListener(`click`,()=>{let e=W.pop();e&&(I.clearRect(0,0,F.width,F.height),I.putImageData(e,0,0),Z())}),document.getElementById(`clear`).addEventListener(`click`,()=>{G(),I.clearRect(0,0,F.width,F.height),Z()});function G(){W.push(I.getImageData(0,0,F.width,F.height)),W.length>15&&W.shift()}var K=!1,q=0,J=0;function Y(e){let t=F.getBoundingClientRect();return[(e.clientX-t.left)*(F.width/t.width),(e.clientY-t.top)*(F.height/t.height)]}F.addEventListener(`pointerdown`,e=>{e.preventDefault(),F.setPointerCapture(e.pointerId),G(),K=!0,[q,J]=Y(e),X(q,J)}),F.addEventListener(`pointermove`,e=>{if(!K)return;let[t,n]=Y(e);I.save(),I.lineCap=`round`,I.lineJoin=`round`,I.lineWidth=H,I.globalCompositeOperation=V?`destination-out`:`source-over`,I.strokeStyle=B,I.beginPath(),I.moveTo(q,J),I.lineTo(t,n),I.stroke(),I.restore(),[q,J]=[t,n],Z()}),F.addEventListener(`pointerup`,()=>{K=!1,Z()});function X(e,t){I.save(),I.globalCompositeOperation=V?`destination-out`:`source-over`,I.fillStyle=B,I.beginPath(),I.arc(e,t,H/2,0,Math.PI*2),I.fill(),I.restore()}function Z(){L.disabled=!Q()}function Q(){let e=I.getImageData(0,0,F.width,F.height).data;for(let t=3;t0)return!0;return!1}function ee(){if(!Q())return;let e=F.toDataURL(`image/png`),t=new Image;t.onload=()=>{let e=$(t),n=Math.min(1.1,Math.max(.35,e.h/150)),r={src:e.src,scale:n};M.push(r),M.length>40&&M.shift(),b(r,e.img)},t.src=e}function $(e){let t=document.createElement(`canvas`);t.width=e.naturalWidth,t.height=e.naturalHeight;let n=t.getContext(`2d`,{willReadFrequently:!0});n.drawImage(e,0,0);let{data:r}=n.getImageData(0,0,t.width,t.height),i=t.width,a=t.height,o=0,s=0;for(let e=0;e10&&(no&&(o=n),es&&(s=e));o{let n=0;for(let r=e;r10&&(e<0&&(e=n),t=n);n+=e<0?0:t-e}return n/Math.max(1,t-e)},m=Math.max(3,Math.round(c*.2)),h=p(0,m),g=p(c-m,c),_=document.createElement(`canvas`);_.width=c,_.height=l;let v=_.getContext(`2d`);h{let e=document.createElement(`canvas`);e.width=200,e.height=130;let t=e.getContext(`2d`),n=Math.floor(Math.random()*360),r=`hsl(${n} 70% 55%)`,i=`hsl(${n} 70% 38%)`;t.fillStyle=i,t.beginPath(),t.moveTo(58,65),t.lineTo(14,34),t.lineTo(24,65),t.lineTo(14,96),t.closePath(),t.fill();let a=t.createLinearGradient(0,30,0,100);a.addColorStop(0,r),a.addColorStop(1,i),t.fillStyle=a,t.beginPath(),t.ellipse(110,65,62,34,0,0,Math.PI*2),t.fill(),t.fillStyle=i,t.beginPath(),t.moveTo(95,34),t.quadraticCurveTo(115,8,135,36),t.closePath(),t.fill(),t.strokeStyle=`hsla(${(n+40)%360} 80% 80% / .55)`,t.lineWidth=7,t.lineCap=`round`;for(let e=0;e<3;e++)t.beginPath(),t.moveTo(88+e*20,40+e*2),t.quadraticCurveTo(84+e*20,65,88+e*20,90-e*2),t.stroke();t.fillStyle=`#fff`,t.beginPath(),t.arc(150,57,8,0,Math.PI*2),t.fill(),t.fillStyle=`#151515`,t.beginPath(),t.arc(152,57,4,0,Math.PI*2),t.fill();let o=new Image;o.onload=()=>{let e=$(o),t={src:e.src,scale:Math.min(1.1,Math.max(.35,e.h/150))};M.push(t),M.length>40&&M.shift(),b(t,e.img)},o.src=e.toDataURL(`image/png`)}),N(),k(); \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..dd5d9de --- /dev/null +++ b/index.html @@ -0,0 +1,22 @@ + + + + + + + Living fishtank | Advent of AI Slop day 1 + + + + + + + + + + + + +
+ + diff --git a/preview.png b/preview.png new file mode 100644 index 0000000..1bc8d69 Binary files /dev/null and b/preview.png differ