0xa89f3db4…071asent to0xecb92cc7…1463·#25,067,892·view on Etherscan
text;e.save(),e.globalCompositeOperation=STATE.baseLayer.blendMode||"source-over",e.globalAlpha=void 0!==STATE.baseLayer.opacity?STATE.baseLayer.opacity:1,e.drawImage(baseLayerGraphics.elt,0,0),e.restore()}else image(baseImage,a,s,t,i)}const n=drawingContext;layers.forEach(e=>{if(!e.visible)return;renderEngine.outputBuffer&&(renderEngine.outputBuffer.clear(),renderEngine.outputBuffer.drawingContext.drawImage(canvas.elt||canvas,0,0)),e.component.update(r,deltaTime),e.graphics.clear(),e.component.draw(e.graphics),e.filters&&"undefined"!=typeof FilterRegistry&&applyLayerFilters(e.graphics,e.filters,r,deltaTime),n.save(),n.globalCompositeOperation=e.blendMode||"source-over",n.globalAlpha=void 0!==e.opacity?e.opacity:1;const t=e.transform||{},i=width/originalWidth,a=height/originalHeight,s=width*(t.anchorX||.5),o=height*(t.anchorY||.5),l=(t.x||0)*i,h=(t.y||0)*a;n.translate(s+l,o+h),n.rotate((t.rotation||0)*Math.PI/180),n.scale(t.scaleX||1,t.scaleY||1),n.translate(-s,-o),n.drawImage(e.graphics.elt,0,0),n.restore()}),STATE.globalFilters&&"undefined"!=typeof FilterRegistry&&applyGlobalFilters(r,deltaTime)}let globalFilterGraphics=null;function applyGlobalFilters(e,t){const i=STATE.globalFilters;if(i){if(i.activeMainFilter){const e=FilterRegistry.create(i.activeMainFilter);if(e){const t=i.mainFilterParams||{};if(e.setParameters(t),e.setEnabled(!0),e.needsGraphicsAccess()){loadPixels();const t=e.processPixels(pixels,width,height);if(t!==pixels)for(let e=0;e<t.length;e++)pixels[e]=t[e];updatePixels()}else{loadPixels();const t=e.processPixels(pixels,width,height);if(t!==pixels)for(let e=0;e<t.length;e++)pixels[e]=t[e];updatePixels()}}}i.processingFilters&&i.processingFilters.length>0&&i.processingFilters.forEach(({name:e,params:t})=>{const i=FilterRegistry.create(e);if(i){t&&i.setParameters(t),i.setEnabled(!0),loadPixels();const e=i.processPixels(pixels,width,height);if(e!==pixels)for(let t=0;t<e.length;t++)pixels[t]=e[t];updatePixels()}}),i.postFilters&&i.postFilters.length>0&&i.postFilters.forEach(({name:e,params:t})=>{const i=FilterRegistry.create(e);if(i){t&&i.setParameters(t),i.setEnabled(!0),loadPixels();const e=i.processPixels(pixels,width,height);if(e!==pixels)for(let t=0;t<e.length;t++)pixels[t]=e[t];updatePixels()}}),i.shaderFilters&&i.shaderFilters.length>0&&(globalFilterGraphics&&globalFilterGraphics.width===width&&globalFilterGraphics.height===height||(globalFilterGraphics&&globalFilterGraphics.remove(),globalFilterGraphics=createGraphics(width,height)),i.shaderFilters.forEach(({name:i,params:a})=>{const s=FilterRegistry.create(i);s&&(a&&s.setParameters(a),s.setEnabled(!0),e&&"function"==typeof s.update&&s.update(t||16,e),globalFilterGraphics.clear(),globalFilterGraphics.image(get(),0,0),s.processGraphics(globalFilterGraphics,width,height),image(globalFilterGraphics,0,0))}))}}function applyLayerFilters(e,t,i,a){const s=e.width,o=e.height;if(t.mainFilter){const i=FilterRegistry.create(t.mainFilter);if(i)if(t.mainFilterParams&&i.setParameters(t.mainFilterParams),i.setEnabled(!0),i.needsGraphicsAccess())i.processGraphics(e,s,o);else{e.loadPixels();const t=i.processPixels(e.pixels,s,o);if(t!==e.pixels)for(let i=0;i<t.length;i++)e.pixels[i]=t[i];e.updatePixels()}}t.processingFilters&&t.processingFilters.forEach(({name:t,params:i})=>{const a=FilterRegistry.create(t);if(a)if(i&&a.setParameters(i),a.setEnabled(!0),a.needsGraphicsAccess())a.processGraphics(e,s,o);else{e.loadPixels();const t=a.processPixels(e.pixels,s,o);if(t!==e.pixels)for(let i=0;i<t.length;i++)e.pixels[i]=t[i];e.updatePixels()}}),t.postFilters&&t.postFilters.forEach(({name:t,params:i})=>{const a=FilterRegistry.create(t);if(a)if(i&&a.setParameters(i),a.setEnabled(!0),a.needsGraphicsAccess())a.processGraphics(e,s,o);else{e.loadPixels();const t=a.processPixels(e.pixels,s,o);if(t!==e.pixels)for(let i=0;i<t.length;i++)e.pixels[i]=t[i];e.updatePixels()}}),t.shaderFilters&&t.shaderFilters.forEach(({name:t,params:r})=>{const n=FilterRegistry.create(t);n&&(r&&n.setParameters(r),n.setEnabled(!0),i&&"function"==typeof n.update&&n.update(a||16,i),n.processGraphics(e,s,o))})}async function mouseClicked(){audioEngine._audioContext&&(await audioEngine.resume(),audioEngine.toggle())}function windowResized(){const e=calculateCanvasSize();resizeCanvas(e.w,e.h),layers.forEach(e=>{e.graphics.remove(),e.graphics=createGraphics(width,height),e.component.resize(width,height)}),baseLayerGraphics&&(baseLayerGraphics.remove(),baseLayerGraphics=createGraphics(width,height)),renderEngine.outputBuffer&&(renderEngine.outputBuffer.remove(),renderEngine.outputBuffer=createGraphics(width,height))}!function(){const e=document.getElementById("tap");if(!e)return;let t=!1;e.addEventListener("click",async function(){if(t)try{await audioEngine.resume();const t=audioEngine.isPlaying;audioEngine.toggle(),e.textContent=audioEngine.isPlaying||!t&&audioEngine._simulating?"[ ■ ]":"[ ▶ ]"}catch(e){console.warn("[tap] toggle failed",e)}else{t=!0,e.textContent="[ loading… ]";try{audioEngine.init(),await audioEngine.resume();let t=null;STATE.audio&&(STATE.audio.sourceUrl?t=STATE.audio.sourceUrl:STATE.audio.tracks&&STATE.audio.tracks.length>0&&STATE.audio.tracks[0].url&&(t=STATE.audio.tracks[0].url)),t?(await audioEngine.loadFromUrl(t),STATE.audio&&STATE.audio.directionalEnabled?(await audioEngine.initDirectionalPlayback(),audioEngine.startDirectional(!0)):audioEngine.play()):audioEngine.toggle(),e.classList.add("live"),e.textContent="[ ■ ]"}catch(i){console.warn("[tap] audio bootstrap failed",i),e.textContent="[ error ]",t=!1}}})}()</script></body></html>