0x85582125…5972sent to0x96a83b48…d253·#22,595,613·view on Etherscan
Ii=!1,Ni=!1;function Ui(){F.save(),F.scale(D,D),Ni||(F.fillStyle="#FFF",F.rect(0,0,Y,P),F.fill(),Ni=!0)}function Di(){F.restore()}function Oi(){Ni=!1}function Bi(e,t="red",n=!0){if(e.length){Ui(),F.beginPath(),F.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)F.lineTo(e[t].x,e[t].y);F.closePath(),F.lineCap="round",n?(F.fillStyle=t,F.fill()):(F.lineWidth=3,F.strokeStyle=t,F.stroke()),Di()}}function Qi(e,t="red",n=!1,l=1){Ui(),F.beginPath(),F.lineCap="round",F.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)F.lineTo(e[t].x,e[t].y);n&&F.closePath(),F.lineWidth=l,F.strokeStyle=t,F.stroke(),Di()}function ji(){Oi();for(let e of[...hn,...Si])if(e.category==mn.foreground){let t=e?.detailObjectProps?.inDominantShapes?.length>0;Bi(e.polygon,t?"blue":"red",!0),Bi(e.polygon,"black",!1)}return!1}function Ji(){Oi();for(let e of[...hn,...Si])if(e.category==mn.foreground){let t=tl(e.detailObject?.[0].lineColor||[0,0,0]);Bi(e.polygon,t,!0),Bi(e.polygon,"black",!1)}return!1}function Ai(){Oi();for(let e of[...hn,...Si])if(e.category==mn.foreground){let t=e.lightingIntensity||Ie.default,n=fe(t,Ie.min,Ie.max,0,255);Bi(e.polygon,`rgba(${n},${n},${n},1)`,!0)}return!1}function Ei(){Oi();for(let e of[...hn,...Si])if(e.category==mn.foreground&&Bi(e.polygon,"black",!1),e?.detailObject?.length)for(let t of e.detailObject)for(let e of t.lines)Qi(e.map((e=>new Ut(...e))),"black",!1,.5);return!1}function _i(){return Oi(),Wi&&Wi.getAllLines().forEach((e=>{Qi(e.line.map((e=>(new ie).fromArray(e))),"black",e.meta.isClosed)})),!1}function qi(){return Oi(),Gi&&Gi.internalFaces().forEach(((e,t)=>{Bi(e.vertexlist,`rgba(${J.num(0,255)},${J.num(0,255)},${J.num(0,255)},0.9)`)})),!1}let $i=!1;function ea(e){let{verts:t,parentSvg:n,strokeColor:l="black",strokeWidth:i=1,className:a="path",isClosed:s=!1}=e,o=`M ${t[0].x} ${t[0].y}`;for(let e=1;e<t.length;e++)o+=` L ${t[e].x} ${t[e].y}`;s&&(o+=" Z");const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",o),r.setAttribute("fill","none"),r.setAttribute("stroke",l),r.setAttribute("stroke-width",i.toString()),r.setAttribute("class",a),n.appendChild(r),r}let ta=()=>{let e=document.querySelector("svg");e?($i=!1,e.remove(),R()):(k(),e=(()=>{let e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("width",O+"px"),e.setAttribute("height",B+"px"),e.setAttribute("style","position: relative; background-color: white;"),e.setAttribute("viewBox",`0 0 ${Y} ${P}`),e.setAttribute("preserveAspectRatio","xMinYMin meet"),e.setAttribute("xmlns","http://www.w3.org/2000/svg");let t=[[new Ut(0,5),new Ut(0,0),new Ut(5,0)],[new Ut(0,P-5),new Ut(0,P),new Ut(5,P)],[new Ut(Y-5,0),new Ut(Y,0),new Ut(Y,5)],[new Ut(Y-5,P),new Ut(Y,P),new Ut(Y,P-5)]];for(let n=0;n<t.length;n++)ea({verts:t[n],parentSvg:e,strokeWidth:2,className:"marker",isClosed:!1,strokeColor:"rgb(1, 0, 0)"});for(let t of[...Si,...hn])if(t.category==mn.foreground){if(ea({verts:t.polygon,parentSvg:e,strokeWidth:2,className:"outline",isClosed:!0,strokeColor:t?.detailObjectProps?.inDominantShapes?.length>0?"rgb(0, 0, 0)":"rgb(1, 1, 1)"}),!t?.detailObject?.length)continue;for(let n of t?.detailObject)if("detail"===n.type)for(let t of n?.lines)ea({verts:t.map((e=>new Ut(...e))),parentSvg:e,strokeWidth:1,className:"detail",strokeColor:"rgb(5, 5, 5)"})}else if(t.category==mn.walker){if(!t?.detailObject?.length)continue;for(let n of t.detailObject)for(let t of n.lines)ea({verts:t.map((e=>new Ut(...e))),parentSvg:e,strokeWidth:4,className:"topline",isClosed:!1,strokeColor:"rgb(10, 10, 10)"})}else if(t.category==mn.overlay){let n=2;for(let l=0;l<n;l++)ea({verts:t.polygon,parentSvg:e,strokeWidth:2,className:"oerlay",isClosed:!0,strokeColor:"rgb(15, 15, 15)"})}return e})(),document.body.appendChild(e),$i=!0)},na=!1;const la=()=>{Fi()[Hi]()?(H(),R()):(k(),M.style.display="block"),Ii=!Ii,Hi=(Hi+1)%Fi().length},ia=()=>{na=!na};var aa;document.complete=!1,(()=>{let n=new URL(window.location.href),l=n.searchParams.get("noFrame");const{innerWidth:i,innerHeight:a}=window;if(l&&(E=0,globalThis.document.body.classList.add("noFrame")),n.searchParams.get("unlockAspect")){let e=N/(i/a);N=i/a,e>1&&(I=a/i*(I-400)),E=0,globalThis.document.body.classList.add("noFrame")}S=document.createElement("canvas"),S.style.backgroundColor="#000",w=S.getContext("webgl2",{colorSpace:"display-p3",preserveDrawingBuffer:!0,stencil:!1,alpha:!1,premultipliedAlpha:!1}),X=new e.WebGLRenderer({canvas:S,context:w,preserveDrawingBuffer:!0,precision:"highp",alpha:!1,premultipliedAlpha:!1,antialias:!1,stencil:!1,depth:!0,powerPreference:"high-performance"}),K=!!w.getExtension("OES_texture_float_linear"),w.getParameter(w.MAX_UNIFORM_BLOCK_SIZE),X.setClearColor(new e.Color(1,1,1),1),C=X.capabilities.maxTextureSize,V=X.capabilities.getMaxAnisotropy(),X.shadowMap.enabled=!0,X.outputColorSpace=e.DisplayP3ColorSpace,X.shadowMap.type=e.PCFSoftShadowMap,document.body.appendChild(S),M=document.createElement("canvas"),M.style.backgroundColor="#000",z=M.style,F=M.getContext("2d",{alpha:!1,colorSpace:"display-p3"}),document.body.appendChild(M),H(),Y=t(I*N),P=t(I);let s=E/100*o(i,a);i<a*N?(B=t(1/N*(i-s)),O=t(i-s)):(B=t(a-s),O=t((a-s)*N)),X.setSize(O,B),X.setPixelRatio(U),Q=O*U,j=B*U,((e,t)=>{M.width=e,M.height=t,z.width=O+"px",z.height=B+"px"})(Q,j),D=Q/Y})(),aa=$(),J=new _(aa||""),(()=>{let t=document.createElement("a");addEventListener("keydown",(n=>{if("s"===n.key&&$i){let e=document.querySelector("svg");if(!e)return;let n=A+".svg";t.setAttribute("download",n);const l=new Blob([e.outerHTML],{type:"image/svg+xml"});t.href=URL.createObjectURL(l),t.click()}else if("s"===n.key){let e=A+".png";se.countX>1&&(e=`${A}-${se.index.x}-${se.index.y}.png`),t.setAttribute("download",e),S.toBlob((e=>{t.href=URL.createObjectURL(e),t.click()}))}"Space"===n.code&&ia(),"x"===n.key&&function(){v({showUpdate:!0,message:"Sending Data Buffer",value:A});let t=new e.WebGLRenderTarget(Q,j,{anisotropy:V,colorSpace:e.DisplayP3ColorSpace,minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat,type:e.FloatType,internalFormat:"RGBA32F"});Yt(Ft.getReadBuffer().texture,t);const n=new Float32Array(Q*j*4);X.readRenderTargetPixels(t,0,0,Q,j,n);let l=""+A;se.countX>1&&(l=`${A}-tiled-${se.index.x}-${se.index.y}`),void 0!==window?.electronAPI?.sendPixelData?window.electronAPI.sendPixelData({buffer:Buffer.from(n.buffer),width:Q,height:j,filename:l}):window.framebuffer=n,setTimeout((()=>{L()}),1e3)}(),"v"===n.key&&(Ii&&la(),ta()),"d"===n.key&&($i&&ta(),la())}))})(),document.metaData=(()=>{ke=[J.num(-1,1),J.num(-1,1)];for(let e=0;e<1e3;e++)He.push(J.dec());Re=J.choice(ue),rt=Re.bg[0][0]<.5,J.weightedChoice([20,Gt],[rt?0:1,Wt])();let e={"Genome base":yt||ot,Palette:Re.name,Mutated:"none"!==et.mutation};const t=[{name:"Name",value:ot},{name:"Meta",value:e},{name:"Divisions",value:it},{name:"Division Props",value:nt},{name:"Line Removal",value:at},{name:"Division Chances",value:Object.fromEntries(Object.entries(Ee).map((([e,t])=>[Se[Number(e)],t])))},{name:"lighting",value:Ie},{name:"color props",value:et},{name:"topLines",value:Ne},{name:"dominantLines",value:Oe},{name:"fillStyles",value:je},{name:"detailStyles",value:Qe},{name:"constructionLineProps",value:Ae},{name:"sceneObjects",value:Ue},{name:"colorProps",value:et},{name:"curveProps",value:qe},{name:"fillMargin",value:tt},{name:"grid",value:Be}];for(let e of t);return e})(),S.addEventListener("click",(e=>{let t=e.clientX,n=e.clientY,l=S.getBoundingClientRect();t-=l.left,n-=l.top;let i=new Ut(t*U/D,n*U/D);for(let e of[...hn,...Si])e.category==mn.foreground&&In(e.polygon,i)})),ci();