0xa89f3db4…071asent to0xecb92cc7…1463·#25,210,190·view on Etherscan
baseLayer.filters.mainFilter||STATE.baseLayer.filters.processingFilters&&STATE.baseLayer.filters.processingFilters.length>0||STATE.baseLayer.filters.postFilters&&STATE.baseLayer.filters.postFilters.length>0||STATE.baseLayer.filters.shaderFilters&&STATE.baseLayer.filters.shaderFilters.length>0)&&baseLayerGraphics&&void 0!==FilterRegistry){baseLayerGraphics.clear(),baseLayerGraphics.image(baseImage,a,o,t,i),applyLayerFilters(baseLayerGraphics,STATE.baseLayer.filters,s,deltaTime);const e=drawingContext;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,o,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(s,deltaTime),e.graphics.clear(),e.component.draw(e.graphics),e.filters&&void 0!==FilterRegistry&&applyLayerFilters(e.graphics,e.filters,s,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,o=width*(t.anchorX||.5),r=height*(t.anchorY||.5),l=(t.x||0)*i,h=(t.y||0)*a;n.translate(o+l,r+h),n.rotate((t.rotation||0)*Math.PI/180),n.scale(t.scaleX||1,t.scaleY||1),n.translate(-o,-r),n.drawImage(e.graphics.elt,0,0),n.restore()}),STATE.globalFilters&&void 0!==FilterRegistry&&applyGlobalFilters(s,deltaTime)}window.renderEngine=renderEngine;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 o=FilterRegistry.create(i);o&&(a&&o.setParameters(a),o.setEnabled(!0),e&&"function"==typeof o.update&&o.update(t||16,e),globalFilterGraphics.clear(),globalFilterGraphics.image(get(),0,0),o.processGraphics(globalFilterGraphics,width,height),image(globalFilterGraphics,0,0))}))}}function applyLayerFilters(e,t,i,a){const o=e.width,s=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,o,s);else{e.loadPixels();const t=i.processPixels(e.pixels,o,s);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,o,s);else{e.loadPixels();const t=a.processPixels(e.pixels,o,s);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,o,s);else{e.loadPixels();const t=a.processPixels(e.pixels,o,s);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:n})=>{const r=FilterRegistry.create(t);r&&(n&&r.setParameters(n),r.setEnabled(!0),i&&"function"==typeof r.update&&r.update(a||16,i),r.processGraphics(e,o,s))})}async function mouseClicked(){await audioEngine.resume(),audioEngine.isLoaded&&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))}
</script>
</body>
</html>