shaders 3.0.450 → 3.0.451
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/core/LensDistortion-DG4VHEXV.js +435 -0
- package/dist/core/{ObjectTracker-BWo8H1kh.js → ObjectTracker-DvQF31-0.js} +1 -1
- package/dist/core/{Text-o_dubJeo.js → Text-Dka9dwCa.js} +1 -1
- package/dist/core/gpu/index.d.ts.map +1 -1
- package/dist/core/index.js +105 -94
- package/dist/core/presetRenderer.d.ts.map +1 -1
- package/dist/core/registry.js +95 -94
- package/dist/core/{shaderRegistry-BSrnuqx-.js → shaderRegistry-CkDrffEe.js} +190 -188
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/LensDistortion/index.d.ts +123 -0
- package/dist/core/shaders/LensDistortion/index.d.ts.map +1 -0
- package/dist/core/shaders/LensDistortion/index.js +8 -0
- package/dist/core/shaders/LensFlare/index.js +1 -1
- package/dist/core/shaders/LightEdge/index.js +1 -1
- package/dist/core/shaders/LightLeak/index.js +1 -1
- package/dist/core/shaders/LinearBlur/index.js +1 -1
- package/dist/core/shaders/LinearGradient/index.js +1 -1
- package/dist/core/shaders/LinearWipe/index.js +1 -1
- package/dist/core/shaders/LiquidMetal/index.js +1 -1
- package/dist/core/shaders/Liquify/index.js +1 -1
- package/dist/core/shaders/MagneticFilings/index.js +1 -1
- package/dist/core/shaders/Marble/index.js +1 -1
- package/dist/core/shaders/Mirror/index.js +1 -1
- package/dist/core/shaders/MultiPointGradient/index.js +1 -1
- package/dist/core/shaders/NoiseDissolve/index.js +1 -1
- package/dist/core/shaders/ObjectTracker/index.js +2 -2
- package/dist/core/shaders/PagePeel/index.js +1 -1
- package/dist/core/shaders/Paper/index.js +1 -1
- package/dist/core/shaders/Parallelogram/index.js +1 -1
- package/dist/core/shaders/ParticleField/index.js +1 -1
- package/dist/core/shaders/ParticleFlow/index.js +1 -1
- package/dist/core/shaders/Particles/index.js +1 -1
- package/dist/core/shaders/PerlinNoise/index.js +1 -1
- package/dist/core/shaders/Perspective/index.js +1 -1
- package/dist/core/shaders/PixelSort/index.js +1 -1
- package/dist/core/shaders/PixelThrow/index.js +1 -1
- package/dist/core/shaders/Pixelate/index.js +1 -1
- package/dist/core/shaders/Plasma/index.js +1 -1
- package/dist/core/shaders/Plastic/index.js +1 -1
- package/dist/core/shaders/PolarCoordinates/index.js +1 -1
- package/dist/core/shaders/Polygon/index.js +1 -1
- package/dist/core/shaders/Posterize/index.js +1 -1
- package/dist/core/shaders/Prism/index.js +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.js +1 -1
- package/dist/core/shaders/RadialGradient/index.js +1 -1
- package/dist/core/shaders/RadialWipe/index.js +1 -1
- package/dist/core/shaders/RandomBars/index.js +1 -1
- package/dist/core/shaders/ReactionDiffusion/index.js +1 -1
- package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
- package/dist/core/shaders/ReflectivePlane/index.js +1 -1
- package/dist/core/shaders/Repeater/index.js +1 -1
- package/dist/core/shaders/Ring/index.js +1 -1
- package/dist/core/shaders/RippleWipe/index.js +1 -1
- package/dist/core/shaders/Ripples/index.js +1 -1
- package/dist/core/shaders/RoundedRect/index.js +1 -1
- package/dist/core/shaders/Saturation/index.js +1 -1
- package/dist/core/shaders/Scratches/index.js +1 -1
- package/dist/core/shaders/Sharpness/index.js +1 -1
- package/dist/core/shaders/Shatter/index.js +1 -1
- package/dist/core/shaders/SimplexNoise/index.js +1 -1
- package/dist/core/shaders/SineWave/index.js +1 -1
- package/dist/core/shaders/SliceWipe/index.js +1 -1
- package/dist/core/shaders/Smoke/index.js +1 -1
- package/dist/core/shaders/SmokeFill/index.js +1 -1
- package/dist/core/shaders/SmokeFlow/index.js +1 -1
- package/dist/core/shaders/Solarize/index.js +1 -1
- package/dist/core/shaders/SolidColor/index.js +1 -1
- package/dist/core/shaders/Spherize/index.js +1 -1
- package/dist/core/shaders/Spiral/index.js +1 -1
- package/dist/core/shaders/Star/index.js +1 -1
- package/dist/core/shaders/Stone/index.js +1 -1
- package/dist/core/shaders/Strands/index.js +1 -1
- package/dist/core/shaders/Stretch/index.js +1 -1
- package/dist/core/shaders/Stripes/index.js +1 -1
- package/dist/core/shaders/StudioBackground/index.js +1 -1
- package/dist/core/shaders/SunBurst/index.js +1 -1
- package/dist/core/shaders/Surface3D/index.js +1 -1
- package/dist/core/shaders/Swirl/index.js +1 -1
- package/dist/core/shaders/Teardrop/index.js +1 -1
- package/dist/core/shaders/Text/index.js +2 -2
- package/dist/core/shaders/TiltShift/index.js +1 -1
- package/dist/core/shaders/TimeTrail/index.js +1 -1
- package/dist/core/shaders/Tint/index.js +1 -1
- package/dist/core/shaders/Trapezoid/index.js +1 -1
- package/dist/core/shaders/TriangularGrid/index.js +1 -1
- package/dist/core/shaders/Tritone/index.js +1 -1
- package/dist/core/shaders/Truchet/index.js +1 -1
- package/dist/core/shaders/Twirl/index.js +1 -1
- package/dist/core/shaders/VHS/index.js +1 -1
- package/dist/core/shaders/VenetianBlinds/index.js +1 -1
- package/dist/core/shaders/Vesica/index.js +1 -1
- package/dist/core/shaders/Vibrance/index.js +1 -1
- package/dist/core/shaders/VideoTexture/index.js +1 -1
- package/dist/core/shaders/Vignette/index.js +1 -1
- package/dist/core/shaders/Voronoi/index.js +1 -1
- package/dist/core/shaders/Water/index.js +1 -1
- package/dist/core/shaders/Watercolor/index.js +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +1 -1
- package/dist/core/shaders/WaveletNoise/index.js +1 -1
- package/dist/core/shaders/Weave/index.js +1 -1
- package/dist/core/shaders/WebcamTexture/index.js +1 -1
- package/dist/core/shaders/Wool/index.js +1 -1
- package/dist/core/shaders/WorleyNoise/index.js +1 -1
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/js/bundle.js +90 -90
- package/dist/js/createShader.js +1 -1
- package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/js/utils/generatePresetCode.js +27 -0
- package/dist/react/LensDistortion.js +226 -0
- package/dist/react/Preview.js +1 -0
- package/dist/react/Shader.js +1 -1
- package/dist/react/bundle.js +75 -75
- package/dist/react/components/LensDistortion.d.ts +54 -0
- package/dist/react/components/LensDistortion.d.ts.map +1 -0
- package/dist/react/engine/Preview.d.ts.map +1 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -1
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +27 -0
- package/dist/registry.js +585 -0
- package/dist/solid/components/LensDistortion.d.ts +51 -0
- package/dist/solid/components/LensDistortion.d.ts.map +1 -0
- package/dist/solid/components/LensDistortion.js +232 -0
- package/dist/solid/engine/Preview.d.ts.map +1 -1
- package/dist/solid/engine/Preview.js +193 -191
- package/dist/solid/engine/Shader.js +1 -1
- package/dist/solid/index.d.ts +1 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +194 -192
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +27 -0
- package/dist/svelte/components/LensDistortion.svelte.d.ts +41 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +2751 -2544
- package/dist/svelte/source/components/LensDistortion.svelte +365 -0
- package/dist/svelte/source/engine/Preview.svelte +2 -0
- package/dist/svelte/source/index.js +1 -0
- package/dist/svelte/utils/generatePresetCode.js +27 -0
- package/dist/vue/LensDistortion.js +3 -0
- package/dist/vue/LensDistortion.vue_vue_type_script_setup_true_lang.js +244 -0
- package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/vue/components/LensDistortion.vue.d.ts +76 -0
- package/dist/vue/components/LensDistortion.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +2 -1
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +27 -0
- package/package.json +9 -1
- /package/dist/core/{LensFlare-G73cvrIG.js → LensFlare-DO5lm--6.js} +0 -0
- /package/dist/core/{LightEdge-D3i7HUR9.js → LightEdge-CxWsQwpZ.js} +0 -0
- /package/dist/core/{LightLeak-B8yGreP-.js → LightLeak-tGJW6l2_.js} +0 -0
- /package/dist/core/{LinearBlur-BEzNPe0e.js → LinearBlur-OmZcUden.js} +0 -0
- /package/dist/core/{LinearGradient-XjXyaoii.js → LinearGradient-DDqFujWC.js} +0 -0
- /package/dist/core/{LinearWipe-Doj9aS5n.js → LinearWipe-BzthBFNb.js} +0 -0
- /package/dist/core/{LiquidMetal-CWV_RQip.js → LiquidMetal-DpRAJ5Ne.js} +0 -0
- /package/dist/core/{Liquify-DWrgFruC.js → Liquify-BVzmuY6D.js} +0 -0
- /package/dist/core/{MagneticFilings-Co0V07-1.js → MagneticFilings-BP1KyU2C.js} +0 -0
- /package/dist/core/{Marble-D13mDBvL.js → Marble-abj97ioG.js} +0 -0
- /package/dist/core/{Mirror-DvukM_eG.js → Mirror-BYqbXWUj.js} +0 -0
- /package/dist/core/{MultiPointGradient-CyK_Ty9a.js → MultiPointGradient-DZZSkiDv.js} +0 -0
- /package/dist/core/{NoiseDissolve-CeX3VO8J.js → NoiseDissolve-DSkh5NdD.js} +0 -0
- /package/dist/core/{PagePeel-BL5IeBeD.js → PagePeel-DWtgqWdt.js} +0 -0
- /package/dist/core/{Paper-BAq9MqtG.js → Paper-DGzZsv79.js} +0 -0
- /package/dist/core/{Parallelogram-DYzFG9ci.js → Parallelogram-Ce0Pg7DX.js} +0 -0
- /package/dist/core/{ParticleField-Bl4uztO7.js → ParticleField-CgCOigET.js} +0 -0
- /package/dist/core/{ParticleFlow-RPxLP8HC.js → ParticleFlow-CRQhvYQx.js} +0 -0
- /package/dist/core/{Particles-BDEX4Fw2.js → Particles-fKk9qTkl.js} +0 -0
- /package/dist/core/{PerlinNoise-BtXlaEd8.js → PerlinNoise-DIFK1BpN.js} +0 -0
- /package/dist/core/{Perspective-CdU5nAEn.js → Perspective-CDNz_7y5.js} +0 -0
- /package/dist/core/{PixelSort-C7TX1ClH.js → PixelSort-sgh5ghCc.js} +0 -0
- /package/dist/core/{PixelThrow-DpKEZPMK.js → PixelThrow-CXtB4Am2.js} +0 -0
- /package/dist/core/{Pixelate-C2OQUtqr.js → Pixelate-BSOzwVHo.js} +0 -0
- /package/dist/core/{Plasma-DLq9HroF.js → Plasma-G6Hl__3L.js} +0 -0
- /package/dist/core/{Plastic-C2hiOaXw.js → Plastic-B6F2WeaX.js} +0 -0
- /package/dist/core/{PolarCoordinates-Bumv-Hi3.js → PolarCoordinates-Bi99omfI.js} +0 -0
- /package/dist/core/{Polygon-DOpR58g4.js → Polygon-BFxoe-Fg.js} +0 -0
- /package/dist/core/{Posterize-CVNOkDme.js → Posterize-DxiCXLUL.js} +0 -0
- /package/dist/core/{Prism-CCQ1BsBL.js → Prism-D6J-acZf.js} +0 -0
- /package/dist/core/{ProgressiveBlur-Cprr1XSE.js → ProgressiveBlur-Bko6UMxQ.js} +0 -0
- /package/dist/core/{RadialGradient-CsmCSySC.js → RadialGradient-B_Dgxs9_.js} +0 -0
- /package/dist/core/{RadialWipe-BAnsqol4.js → RadialWipe-U9n5aeiJ.js} +0 -0
- /package/dist/core/{RandomBars-DdhtxO8o.js → RandomBars-U_zpGDJh.js} +0 -0
- /package/dist/core/{ReactionDiffusion-Bih4xEtV.js → ReactionDiffusion-I9xj-iK_.js} +0 -0
- /package/dist/core/{RectangularCoordinates-CKKA2oY1.js → RectangularCoordinates-DX6wutjX.js} +0 -0
- /package/dist/core/{ReflectivePlane-u3Tje37M.js → ReflectivePlane-DU9pf-7H.js} +0 -0
- /package/dist/core/{Repeater-C-agsqBS.js → Repeater-kCIaHHFy.js} +0 -0
- /package/dist/core/{Ring-Cj7bR89h.js → Ring-B_tYq3KV.js} +0 -0
- /package/dist/core/{RippleWipe-VL1MMd5o.js → RippleWipe-DCgZZ4VT.js} +0 -0
- /package/dist/core/{Ripples-B88TeopS.js → Ripples-BDhMh7XC.js} +0 -0
- /package/dist/core/{RoundedRect-jn8_QLrT.js → RoundedRect-9b3REf2d.js} +0 -0
- /package/dist/core/{Saturation-dCNIhHq2.js → Saturation-CcblT031.js} +0 -0
- /package/dist/core/{Scratches-Dz_1Ptk0.js → Scratches-Rzk27V6D.js} +0 -0
- /package/dist/core/{Sharpness-Bxq4YiRL.js → Sharpness-ClLOnNR8.js} +0 -0
- /package/dist/core/{Shatter-DsuYUr-1.js → Shatter-CLI896c7.js} +0 -0
- /package/dist/core/{SimplexNoise-CvalBPNF.js → SimplexNoise-98RPhPzU.js} +0 -0
- /package/dist/core/{SineWave-XPK5BsPB.js → SineWave-BZPrTdYD.js} +0 -0
- /package/dist/core/{SliceWipe-gSs_VRwf.js → SliceWipe-BR5Qr38C.js} +0 -0
- /package/dist/core/{Smoke-kzRXFLW9.js → Smoke-DoW6Brlo.js} +0 -0
- /package/dist/core/{SmokeFill-DQZeqiwX.js → SmokeFill-CXHhKX8u.js} +0 -0
- /package/dist/core/{SmokeFlow-n23YvKoI.js → SmokeFlow-mRJ_JcnZ.js} +0 -0
- /package/dist/core/{Solarize-DINiQSz1.js → Solarize-BNCG4TCa.js} +0 -0
- /package/dist/core/{SolidColor-Cu_9b_my.js → SolidColor-dYxjV0YF.js} +0 -0
- /package/dist/core/{Spherize-BLY2eqBV.js → Spherize-6d5WZIZV.js} +0 -0
- /package/dist/core/{Spiral-CWCmvI3m.js → Spiral-IOZ-Zm0_.js} +0 -0
- /package/dist/core/{Star-9WSeF-vW.js → Star-D9txpy4P.js} +0 -0
- /package/dist/core/{Stone-CVO2Ey8i.js → Stone-H2qLOvGJ.js} +0 -0
- /package/dist/core/{Strands-D9Sz1vX9.js → Strands-Db6_uJAi.js} +0 -0
- /package/dist/core/{Stretch-DMT2Y6kN.js → Stretch-BIFeD7-1.js} +0 -0
- /package/dist/core/{Stripes-DPVbOQkX.js → Stripes-5YZhE4bc.js} +0 -0
- /package/dist/core/{StudioBackground-5JgYClrr.js → StudioBackground-B16ICQTt.js} +0 -0
- /package/dist/core/{SunBurst-Din5CIAU.js → SunBurst-DSUFLqjC.js} +0 -0
- /package/dist/core/{Surface3D-CW2ApEgt.js → Surface3D-BoliMAeJ.js} +0 -0
- /package/dist/core/{Swirl-DrchXPfh.js → Swirl-CozBN2cj.js} +0 -0
- /package/dist/core/{Teardrop-CDt_XA4d.js → Teardrop-D8uqqHu8.js} +0 -0
- /package/dist/core/{TiltShift-DJVcMb_M.js → TiltShift-CNc1M7bT.js} +0 -0
- /package/dist/core/{TimeTrail-D1Gir7BK.js → TimeTrail-BFuqrI-l.js} +0 -0
- /package/dist/core/{Tint-Cak_PyOJ.js → Tint-BzCm1m93.js} +0 -0
- /package/dist/core/{Trapezoid-DnFhlKCD.js → Trapezoid-Dc6dpnCU.js} +0 -0
- /package/dist/core/{TriangularGrid-BE9CgVlb.js → TriangularGrid-BMemTQ8X.js} +0 -0
- /package/dist/core/{Tritone-mqU9b4YZ.js → Tritone-XnyfjYXL.js} +0 -0
- /package/dist/core/{Truchet-yLdaw6z4.js → Truchet-DUbAZPvr.js} +0 -0
- /package/dist/core/{Twirl-SA6uh8pI.js → Twirl-Dj6ZOh7V.js} +0 -0
- /package/dist/core/{VHS-Ch-bVeit.js → VHS-DcN38Sa-.js} +0 -0
- /package/dist/core/{VenetianBlinds-CboEoPIZ.js → VenetianBlinds-Dsix9S6Y.js} +0 -0
- /package/dist/core/{Vesica-DmJWzk7E.js → Vesica-BvLPrNBY.js} +0 -0
- /package/dist/core/{Vibrance-7rW_G3qT.js → Vibrance-B3F1IOJC.js} +0 -0
- /package/dist/core/{VideoTexture-Ctk5_1F8.js → VideoTexture-rZnbkY1j.js} +0 -0
- /package/dist/core/{Vignette-DXtlR5LT.js → Vignette-D747S9Un.js} +0 -0
- /package/dist/core/{Voronoi-B0ZrQ6QO.js → Voronoi-tdjJp1Yz.js} +0 -0
- /package/dist/core/{Water-DfwGqSnM.js → Water-wnYFmeVF.js} +0 -0
- /package/dist/core/{Watercolor-BAShYSu7.js → Watercolor-DlrWTnkX.js} +0 -0
- /package/dist/core/{WaveDistortion-Cj4QBBKm.js → WaveDistortion-11QwOfVR.js} +0 -0
- /package/dist/core/{WaveletNoise-DYiU_ziD.js → WaveletNoise-DWOzHG3M.js} +0 -0
- /package/dist/core/{Weave-DVefdB9i.js → Weave-CdGwj7cZ.js} +0 -0
- /package/dist/core/{WebcamTexture-BO9jNxcP.js → WebcamTexture-CihYSbzd.js} +0 -0
- /package/dist/core/{Wool-D304TmpD.js → Wool-DKCBMabi.js} +0 -0
- /package/dist/core/{WorleyNoise-B5FBTklZ.js → WorleyNoise-BjD32UOl.js} +0 -0
- /package/dist/core/{ZoomBlur-DxySopLs.js → ZoomBlur-BnRTijPn.js} +0 -0
- /package/dist/core/{fonts-v_F1SFl9.js → fonts-DFuXI3Hk.js} +0 -0
package/dist/js/createShader.js
CHANGED
|
@@ -184,7 +184,7 @@ async function createShader(canvas, preset, options) {
|
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
if (renderer.getPerformanceStats().fps > 0) {
|
|
187
|
-
state.telemetryCollector = startTelemetry(renderer, "3.0.
|
|
187
|
+
state.telemetryCollector = startTelemetry(renderer, "3.0.451", options?.disableTelemetry || false, false);
|
|
188
188
|
if (state.telemetryCollector) state.telemetryCollector.start();
|
|
189
189
|
state.telemetryStartTimeout = null;
|
|
190
190
|
} else state.telemetryStartTimeout = setTimeout(checkRendering, 500);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;
|
|
1
|
+
{"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAo5FD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAwBpM;AAGD,eAAO,MAAM,mBAAmB,UAgM/B,CAAA"}
|
|
@@ -1300,6 +1300,32 @@ var shaderMetadata = {
|
|
|
1300
1300
|
"keyframeColor": "#ffcf33",
|
|
1301
1301
|
"pathColor": "#ffffffb8"
|
|
1302
1302
|
},
|
|
1303
|
+
"LensDistortion": {
|
|
1304
|
+
"opacity": 1,
|
|
1305
|
+
"blendMode": "normal",
|
|
1306
|
+
"center": {
|
|
1307
|
+
"x": .5,
|
|
1308
|
+
"y": .5
|
|
1309
|
+
},
|
|
1310
|
+
"spread": .6,
|
|
1311
|
+
"angle": 0,
|
|
1312
|
+
"perspective": .1,
|
|
1313
|
+
"bias": 1,
|
|
1314
|
+
"count": 35,
|
|
1315
|
+
"dispersion": 1,
|
|
1316
|
+
"dispersionShift": 0,
|
|
1317
|
+
"dispersionColor": .6,
|
|
1318
|
+
"focusCenter": .8,
|
|
1319
|
+
"focusEdges": 1,
|
|
1320
|
+
"lensBulge": 0,
|
|
1321
|
+
"lensCircle": 0,
|
|
1322
|
+
"swirl": .35,
|
|
1323
|
+
"noise": 0,
|
|
1324
|
+
"noiseFrequency": .25,
|
|
1325
|
+
"noiseOffset": 0,
|
|
1326
|
+
"grainMixer": 0,
|
|
1327
|
+
"grainOverlay": 0
|
|
1328
|
+
},
|
|
1303
1329
|
"LensFlare": {
|
|
1304
1330
|
"opacity": 1,
|
|
1305
1331
|
"blendMode": "normal",
|
|
@@ -2939,6 +2965,7 @@ const availableComponents = [
|
|
|
2939
2965
|
"IsometricCubes",
|
|
2940
2966
|
"Kaleidoscope",
|
|
2941
2967
|
"KeyFrames",
|
|
2968
|
+
"LensDistortion",
|
|
2942
2969
|
"LensFlare",
|
|
2943
2970
|
"LightEdge",
|
|
2944
2971
|
"LightLeak",
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { ShaderContext } from "./Shader.js";
|
|
2
|
+
import { useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { createGpuUniformsMap, resolveBoundingBox } from "../core/index.js";
|
|
5
|
+
import { setColorSpaceMode } from "../core/utilities/transformations/index.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { componentDefinition } from "../core/shaders/LensDistortion/index.js";
|
|
8
|
+
function isPropDriver(value) {
|
|
9
|
+
return typeof value === "object" && value !== null && "type" in value && (value.type === "map" || value.type === "mouse" || value.type === "mouse-position" || value.type === "auto-animate");
|
|
10
|
+
}
|
|
11
|
+
function computeEffectiveProps(props, defaultProps$1) {
|
|
12
|
+
let baseProps = { ...defaultProps$1 };
|
|
13
|
+
for (const [key, value] of Object.entries(props)) if (key !== "children" && key !== "ref" && value !== void 0 && !isPropDriver(value)) baseProps[key] = value;
|
|
14
|
+
return baseProps;
|
|
15
|
+
}
|
|
16
|
+
var MARKER_STYLE = { display: "contents" };
|
|
17
|
+
var DEFAULT_TRANSFORM = {
|
|
18
|
+
offsetX: 0,
|
|
19
|
+
offsetY: 0,
|
|
20
|
+
rotation: 0,
|
|
21
|
+
scale: 1,
|
|
22
|
+
anchorX: .5,
|
|
23
|
+
anchorY: .5,
|
|
24
|
+
edges: "transparent"
|
|
25
|
+
};
|
|
26
|
+
var defaultProps = {
|
|
27
|
+
blendMode: "normal",
|
|
28
|
+
visible: true
|
|
29
|
+
};
|
|
30
|
+
try {
|
|
31
|
+
if (componentDefinition && componentDefinition.props) Object.entries(componentDefinition.props).forEach(([key, config]) => {
|
|
32
|
+
const propConfig = config;
|
|
33
|
+
if (propConfig && typeof propConfig === "object" && "default" in propConfig) defaultProps[key] = propConfig.default;
|
|
34
|
+
});
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.warn("Error extracting default props:", e);
|
|
37
|
+
}
|
|
38
|
+
const ShaderComponent = (props) => {
|
|
39
|
+
const context = useContext(ShaderContext);
|
|
40
|
+
if (!context) throw new Error("Shader components must be used inside an <Shader> component or another shader component");
|
|
41
|
+
const { shaderParentId: parentId, shaderNodeRegister: parentRegister, shaderUniformUpdate: parentUniformUpdate, shaderMetadataUpdate: parentMetadataUpdate, shaderColorSpace } = context;
|
|
42
|
+
const reactId = useId();
|
|
43
|
+
const instanceId = useMemo(() => {
|
|
44
|
+
return (props.id ? props.id.replace(/[^a-zA-Z0-9_]/g, "_") : null) || reactId.replace(/[^a-zA-Z0-9_]/g, "");
|
|
45
|
+
}, [props.id, reactId]);
|
|
46
|
+
const effectiveProps = useMemo(() => {
|
|
47
|
+
return computeEffectiveProps(props, defaultProps);
|
|
48
|
+
}, [props]);
|
|
49
|
+
const effectiveTransform = useMemo(() => ({
|
|
50
|
+
...DEFAULT_TRANSFORM,
|
|
51
|
+
...props.transform
|
|
52
|
+
}), [props.transform]);
|
|
53
|
+
const effectiveBoundingBox = useMemo(() => resolveBoundingBox(props.boundingBox), [props.boundingBox]);
|
|
54
|
+
const markerRef = useRef(null);
|
|
55
|
+
const isCapturesDOM = !!componentDefinition.capturesDOM;
|
|
56
|
+
const captureCanvasRef = useRef(null);
|
|
57
|
+
const [domMounted, setDomMounted] = useState(false);
|
|
58
|
+
const [captureSize, setCaptureSize] = useState(() => ({
|
|
59
|
+
w: typeof window !== "undefined" ? Math.round(window.innerWidth * Math.min(window.devicePixelRatio, 2)) : 0,
|
|
60
|
+
h: typeof window !== "undefined" ? Math.round(window.innerHeight * Math.min(window.devicePixelRatio, 2)) : 0
|
|
61
|
+
}));
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!isCapturesDOM) return;
|
|
64
|
+
setDomMounted(true);
|
|
65
|
+
const onResize = () => {
|
|
66
|
+
const d = Math.min(window.devicePixelRatio, 2);
|
|
67
|
+
setCaptureSize({
|
|
68
|
+
w: Math.round(window.innerWidth * d),
|
|
69
|
+
h: Math.round(window.innerHeight * d)
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
window.addEventListener("resize", onResize);
|
|
73
|
+
return () => window.removeEventListener("resize", onResize);
|
|
74
|
+
}, [isCapturesDOM]);
|
|
75
|
+
const detectedOrderRef = useRef(void 0);
|
|
76
|
+
const uniformsRef = useRef(null);
|
|
77
|
+
if (uniformsRef.current === null) {
|
|
78
|
+
setColorSpaceMode(shaderColorSpace);
|
|
79
|
+
uniformsRef.current = createGpuUniformsMap(componentDefinition, effectiveProps, instanceId);
|
|
80
|
+
}
|
|
81
|
+
const childContextValue = useMemo(() => {
|
|
82
|
+
return {
|
|
83
|
+
...context,
|
|
84
|
+
shaderParentId: instanceId
|
|
85
|
+
};
|
|
86
|
+
}, [context, instanceId]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!uniformsRef.current) return;
|
|
89
|
+
try {
|
|
90
|
+
const metadata = {
|
|
91
|
+
blendMode: props.blendMode || "normal",
|
|
92
|
+
opacity: props.opacity,
|
|
93
|
+
visible: props.visible === false ? false : true,
|
|
94
|
+
id: props.id,
|
|
95
|
+
mask: props.maskSource ? {
|
|
96
|
+
source: props.maskSource,
|
|
97
|
+
type: props.maskType || "alpha"
|
|
98
|
+
} : void 0,
|
|
99
|
+
maps: mapsFromProps,
|
|
100
|
+
renderOrder: props.renderOrder ?? detectedOrderRef.current,
|
|
101
|
+
transform: effectiveTransform,
|
|
102
|
+
boundingBox: effectiveBoundingBox,
|
|
103
|
+
flow: props.flow,
|
|
104
|
+
absolute: props.absolute
|
|
105
|
+
};
|
|
106
|
+
parentRegister(instanceId, componentDefinition.fragment, parentId, metadata, uniformsRef.current, componentDefinition, isCapturesDOM ? captureCanvasRef.current ?? void 0 : void 0);
|
|
107
|
+
return () => {
|
|
108
|
+
parentRegister(instanceId, null, null, null, null);
|
|
109
|
+
};
|
|
110
|
+
} catch (error) {
|
|
111
|
+
console.error("Error registering shader node:", error);
|
|
112
|
+
return () => {};
|
|
113
|
+
}
|
|
114
|
+
}, [
|
|
115
|
+
instanceId,
|
|
116
|
+
parentId,
|
|
117
|
+
parentRegister,
|
|
118
|
+
domMounted
|
|
119
|
+
]);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (props.renderOrder === void 0 && markerRef.current) {
|
|
122
|
+
const parent = markerRef.current.parentElement;
|
|
123
|
+
if (parent) {
|
|
124
|
+
const siblings = parent.querySelectorAll(":scope > [data-shader-id]");
|
|
125
|
+
const position = Array.from(siblings).indexOf(markerRef.current);
|
|
126
|
+
if (position >= 0) {
|
|
127
|
+
detectedOrderRef.current = position;
|
|
128
|
+
parentMetadataUpdate(instanceId, { renderOrder: position });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, []);
|
|
133
|
+
const prevPropsRef = useRef({});
|
|
134
|
+
const mapsFromProps = useMemo(() => {
|
|
135
|
+
const maps = {};
|
|
136
|
+
for (const [key, value] of Object.entries(props)) if (key !== "children" && key !== "ref" && isPropDriver(value)) maps[key] = value;
|
|
137
|
+
return Object.keys(maps).length > 0 ? maps : void 0;
|
|
138
|
+
}, [props]);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (!uniformsRef.current) return;
|
|
141
|
+
try {
|
|
142
|
+
Object.entries(uniformsRef.current).forEach(([propName, uniformData]) => {
|
|
143
|
+
if (!uniformData || typeof uniformData !== "object") return;
|
|
144
|
+
if (uniformData.value !== void 0 && propName in effectiveProps) {
|
|
145
|
+
const newValue = effectiveProps[propName];
|
|
146
|
+
if (isPropDriver(newValue)) return;
|
|
147
|
+
if (newValue !== prevPropsRef.current[propName]) {
|
|
148
|
+
parentUniformUpdate(instanceId, propName, newValue);
|
|
149
|
+
prevPropsRef.current[propName] = newValue;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.error("Error updating uniforms:", error);
|
|
155
|
+
}
|
|
156
|
+
}, [
|
|
157
|
+
effectiveProps,
|
|
158
|
+
instanceId,
|
|
159
|
+
parentUniformUpdate
|
|
160
|
+
]);
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
try {
|
|
163
|
+
parentMetadataUpdate(instanceId, {
|
|
164
|
+
blendMode: props.blendMode || "normal",
|
|
165
|
+
opacity: props.opacity,
|
|
166
|
+
visible: props.visible === false ? false : true,
|
|
167
|
+
id: props.id,
|
|
168
|
+
mask: props.maskSource ? {
|
|
169
|
+
source: props.maskSource,
|
|
170
|
+
type: props.maskType || "alpha"
|
|
171
|
+
} : void 0,
|
|
172
|
+
maps: mapsFromProps,
|
|
173
|
+
renderOrder: props.renderOrder ?? detectedOrderRef.current,
|
|
174
|
+
transform: effectiveTransform,
|
|
175
|
+
boundingBox: effectiveBoundingBox,
|
|
176
|
+
flow: props.flow,
|
|
177
|
+
absolute: props.absolute
|
|
178
|
+
});
|
|
179
|
+
} catch (error) {
|
|
180
|
+
console.error("Error updating metadata:", error);
|
|
181
|
+
}
|
|
182
|
+
}, [
|
|
183
|
+
props.blendMode,
|
|
184
|
+
props.opacity,
|
|
185
|
+
props.visible,
|
|
186
|
+
props.maskSource,
|
|
187
|
+
props.maskType,
|
|
188
|
+
props.renderOrder,
|
|
189
|
+
props.id,
|
|
190
|
+
mapsFromProps,
|
|
191
|
+
effectiveTransform,
|
|
192
|
+
effectiveBoundingBox,
|
|
193
|
+
props.flow,
|
|
194
|
+
props.absolute,
|
|
195
|
+
instanceId,
|
|
196
|
+
parentMetadataUpdate
|
|
197
|
+
]);
|
|
198
|
+
if (props.ref && typeof props.ref === "function") try {
|
|
199
|
+
props.ref(null);
|
|
200
|
+
} catch (e) {}
|
|
201
|
+
const captureCanvas = isCapturesDOM && domMounted ? createPortal(/* @__PURE__ */ jsx("canvas", {
|
|
202
|
+
ref: captureCanvasRef,
|
|
203
|
+
"layoutsubtree": "",
|
|
204
|
+
width: captureSize.w,
|
|
205
|
+
height: captureSize.h,
|
|
206
|
+
style: {
|
|
207
|
+
position: "fixed",
|
|
208
|
+
inset: 0,
|
|
209
|
+
width: "100vw",
|
|
210
|
+
height: "100vh",
|
|
211
|
+
zIndex: -9999
|
|
212
|
+
},
|
|
213
|
+
children: props.children
|
|
214
|
+
}), document.body) : null;
|
|
215
|
+
return /* @__PURE__ */ jsxs(ShaderContext.Provider, {
|
|
216
|
+
value: childContextValue,
|
|
217
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
218
|
+
ref: markerRef,
|
|
219
|
+
style: MARKER_STYLE,
|
|
220
|
+
"data-shader-id": instanceId,
|
|
221
|
+
children: !isCapturesDOM && props.children
|
|
222
|
+
}), captureCanvas]
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
var LensDistortion_default = ShaderComponent;
|
|
226
|
+
export { ShaderComponent, LensDistortion_default as default };
|
package/dist/react/Preview.js
CHANGED
|
@@ -204,6 +204,7 @@ var componentMap = {
|
|
|
204
204
|
IsometricCubes: lazy(() => import("./IsometricCubes.js")),
|
|
205
205
|
Kaleidoscope: lazy(() => import("./Kaleidoscope.js")),
|
|
206
206
|
KeyFrames: lazy(() => import("./KeyFrames.js")),
|
|
207
|
+
LensDistortion: lazy(() => import("./LensDistortion.js")),
|
|
207
208
|
LensFlare: lazy(() => import("./LensFlare.js")),
|
|
208
209
|
LightEdge: lazy(() => import("./LightEdge.js")),
|
|
209
210
|
LightLeak: lazy(() => import("./LightLeak.js")),
|
package/dist/react/Shader.js
CHANGED
|
@@ -93,7 +93,7 @@ const Shader = ({ children, disableTelemetry = false, colorSpace = "p3-linear",
|
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
if (rendererRef.current.getPerformanceStats().fps > 0) {
|
|
96
|
-
telemetryCollectorRef.current = startTelemetry(rendererRef.current, "3.0.
|
|
96
|
+
telemetryCollectorRef.current = startTelemetry(rendererRef.current, "3.0.451", disableTelemetry, isPreview);
|
|
97
97
|
if (telemetryCollectorRef.current) telemetryCollectorRef.current.start();
|
|
98
98
|
telemetryStartTimeoutRef.current = null;
|
|
99
99
|
} else telemetryStartTimeoutRef.current = window.setTimeout(checkRendering, 500);
|