@3driseai/3drise-viewer 0.1.26 → 0.1.27
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/animationsV2/ClipPlayer.d.ts +3 -0
- package/dist/animationsV2/ClipPlayer.d.ts.map +1 -1
- package/dist/animationsV2/ClipPlayer.js +67 -8
- package/dist/animationsV2/ClipsRuntime.d.ts +39 -0
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +245 -14
- package/dist/animationsV2/appliers.d.ts +5 -0
- package/dist/animationsV2/appliers.d.ts.map +1 -1
- package/dist/animationsV2/appliers.js +25 -7
- package/dist/animationsV2/index.d.ts +1 -1
- package/dist/animationsV2/index.d.ts.map +1 -1
- package/dist/animationsV2/normalize.d.ts.map +1 -1
- package/dist/animationsV2/normalize.js +18 -7
- package/dist/animationsV2/sequenceUtils.d.ts +42 -1
- package/dist/animationsV2/sequenceUtils.d.ts.map +1 -1
- package/dist/animationsV2/sequenceUtils.js +103 -3
- package/dist/animationsV2/types.d.ts +20 -0
- package/dist/animationsV2/types.d.ts.map +1 -1
- package/dist/components/AdvancedGrid.d.ts +8 -2
- package/dist/components/AdvancedGrid.d.ts.map +1 -1
- package/dist/components/AdvancedGrid.js +31 -14
- package/dist/components/AnimatedObject.d.ts.map +1 -1
- package/dist/components/AnimatedObject.js +7 -5
- package/dist/components/Bubbles.d.ts +7 -1
- package/dist/components/Bubbles.d.ts.map +1 -1
- package/dist/components/Bubbles.js +42 -22
- package/dist/components/ChladniGrid.d.ts +8 -4
- package/dist/components/ChladniGrid.d.ts.map +1 -1
- package/dist/components/ChladniGrid.js +31 -13
- package/dist/components/CircuitGrid.d.ts +8 -11
- package/dist/components/CircuitGrid.d.ts.map +1 -1
- package/dist/components/CircuitGrid.js +31 -13
- package/dist/components/CloudsGenerator.d.ts +1 -1
- package/dist/components/CloudsGenerator.js +1 -1
- package/dist/components/ContourGrid.d.ts +8 -14
- package/dist/components/ContourGrid.d.ts.map +1 -1
- package/dist/components/ContourGrid.js +31 -13
- package/dist/components/EffectsGenerator.d.ts +7 -1
- package/dist/components/EffectsGenerator.d.ts.map +1 -1
- package/dist/components/EffectsGenerator.js +39 -38
- package/dist/components/EnvironmentManager.d.ts +4 -4
- package/dist/components/EnvironmentManager.d.ts.map +1 -1
- package/dist/components/FlowNetGrid.d.ts +8 -4
- package/dist/components/FlowNetGrid.d.ts.map +1 -1
- package/dist/components/FlowNetGrid.js +31 -13
- package/dist/components/FractalGrid.d.ts +8 -12
- package/dist/components/FractalGrid.d.ts.map +1 -1
- package/dist/components/FractalGrid.js +31 -13
- package/dist/components/GirihGrid.d.ts +8 -1
- package/dist/components/GirihGrid.d.ts.map +1 -1
- package/dist/components/GirihGrid.js +31 -13
- package/dist/components/Glyphs.d.ts +7 -1
- package/dist/components/Glyphs.d.ts.map +1 -1
- package/dist/components/Glyphs.js +40 -34
- package/dist/components/GravWaveGrid.d.ts +8 -1
- package/dist/components/GravWaveGrid.d.ts.map +1 -1
- package/dist/components/GravWaveGrid.js +31 -13
- package/dist/components/GridsGenerator.d.ts +7 -1
- package/dist/components/GridsGenerator.d.ts.map +1 -1
- package/dist/components/GridsGenerator.js +20 -18
- package/dist/components/HexGrid.d.ts +8 -10
- package/dist/components/HexGrid.d.ts.map +1 -1
- package/dist/components/HexGrid.js +31 -13
- package/dist/components/HyperbolicGrid.d.ts +8 -4
- package/dist/components/HyperbolicGrid.d.ts.map +1 -1
- package/dist/components/HyperbolicGrid.js +31 -13
- package/dist/components/LandscapeBuilder.d.ts +1 -1
- package/dist/components/LandscapeBuilder.d.ts.map +1 -1
- package/dist/components/LandscapeBuilder.js +1 -1
- package/dist/components/LandscapeObject.d.ts +1 -1
- package/dist/components/LandscapeObject.d.ts.map +1 -1
- package/dist/components/LandscapeObject.js +1 -1
- package/dist/components/MoireGrid.d.ts +8 -12
- package/dist/components/MoireGrid.d.ts.map +1 -1
- package/dist/components/MoireGrid.js +31 -13
- package/dist/components/ObjectNode.d.ts.map +1 -1
- package/dist/components/ObjectNode.js +2 -2
- package/dist/components/ObjectsRenderer.d.ts.map +1 -1
- package/dist/components/ObjectsRenderer.js +37 -3
- package/dist/components/OceanBuilder.d.ts +1 -1
- package/dist/components/OceanBuilder.js +1 -1
- package/dist/components/ParticlesGenerator.d.ts.map +1 -1
- package/dist/components/ParticlesGenerator.js +6 -0
- package/dist/components/QuasiGrid.d.ts +8 -11
- package/dist/components/QuasiGrid.d.ts.map +1 -1
- package/dist/components/QuasiGrid.js +31 -13
- package/dist/components/RadarGrid.d.ts +8 -13
- package/dist/components/RadarGrid.d.ts.map +1 -1
- package/dist/components/RadarGrid.js +31 -13
- package/dist/components/ReactionDiffusionGrid.d.ts +8 -1
- package/dist/components/ReactionDiffusionGrid.d.ts.map +1 -1
- package/dist/components/ReactionDiffusionGrid.js +33 -139
- package/dist/components/SceneBuilder.js +1 -1
- package/dist/components/SkySystem.d.ts +1 -1
- package/dist/components/SparklesBurst.d.ts +7 -1
- package/dist/components/SparklesBurst.d.ts.map +1 -1
- package/dist/components/SparklesBurst.js +31 -28
- package/dist/components/TerrainBuilder.d.ts +1 -1
- package/dist/components/TerrainBuilder.d.ts.map +1 -1
- package/dist/components/TerrainBuilder.js +1 -1
- package/dist/components/VoronoiGrid.d.ts +8 -10
- package/dist/components/VoronoiGrid.d.ts.map +1 -1
- package/dist/components/VoronoiGrid.js +31 -13
- package/dist/components/WallpaperGrid.d.ts +8 -1
- package/dist/components/WallpaperGrid.d.ts.map +1 -1
- package/dist/components/WallpaperGrid.js +33 -210
- package/dist/components/effects/AuraEffect.d.ts +8 -3
- package/dist/components/effects/AuraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuraEffect.js +49 -24
- package/dist/components/effects/AuroraEffect.d.ts +8 -3
- package/dist/components/effects/AuroraEffect.d.ts.map +1 -1
- package/dist/components/effects/AuroraEffect.js +45 -25
- package/dist/components/effects/BlackHoleEffect.d.ts +8 -3
- package/dist/components/effects/BlackHoleEffect.d.ts.map +1 -1
- package/dist/components/effects/BlackHoleEffect.js +42 -21
- package/dist/components/effects/ConstellationEffect.d.ts +8 -3
- package/dist/components/effects/ConstellationEffect.d.ts.map +1 -1
- package/dist/components/effects/ConstellationEffect.js +49 -23
- package/dist/components/effects/DandelionSeedsEffect.d.ts +7 -2
- package/dist/components/effects/DandelionSeedsEffect.d.ts.map +1 -1
- package/dist/components/effects/DandelionSeedsEffect.js +19 -9
- package/dist/components/effects/DataStreamEffect.d.ts +8 -3
- package/dist/components/effects/DataStreamEffect.d.ts.map +1 -1
- package/dist/components/effects/DataStreamEffect.js +54 -26
- package/dist/components/effects/DnaHelixEffect.d.ts +8 -3
- package/dist/components/effects/DnaHelixEffect.d.ts.map +1 -1
- package/dist/components/effects/DnaHelixEffect.js +62 -30
- package/dist/components/effects/FallingLeavesEffect.d.ts +7 -2
- package/dist/components/effects/FallingLeavesEffect.d.ts.map +1 -1
- package/dist/components/effects/FallingLeavesEffect.js +19 -9
- package/dist/components/effects/FieldLinesEffect.d.ts +8 -3
- package/dist/components/effects/FieldLinesEffect.d.ts.map +1 -1
- package/dist/components/effects/FieldLinesEffect.js +30 -20
- package/dist/components/effects/Fire.d.ts +8 -3
- package/dist/components/effects/Fire.d.ts.map +1 -1
- package/dist/components/effects/Fire.js +47 -10
- package/dist/components/effects/FireflySwarmEffect.d.ts +7 -2
- package/dist/components/effects/FireflySwarmEffect.d.ts.map +1 -1
- package/dist/components/effects/FireflySwarmEffect.js +19 -9
- package/dist/components/effects/Flares.d.ts +10 -3
- package/dist/components/effects/Flares.d.ts.map +1 -1
- package/dist/components/effects/Flares.js +53 -56
- package/dist/components/effects/ForcefieldEffect.d.ts +8 -3
- package/dist/components/effects/ForcefieldEffect.d.ts.map +1 -1
- package/dist/components/effects/ForcefieldEffect.js +52 -33
- package/dist/components/effects/GalaxyEffect.d.ts +7 -2
- package/dist/components/effects/GalaxyEffect.d.ts.map +1 -1
- package/dist/components/effects/GalaxyEffect.js +19 -9
- package/dist/components/effects/HarmonicShellEffect.d.ts +8 -3
- package/dist/components/effects/HarmonicShellEffect.d.ts.map +1 -1
- package/dist/components/effects/HarmonicShellEffect.js +30 -22
- package/dist/components/effects/HologramEffect.d.ts +8 -3
- package/dist/components/effects/HologramEffect.d.ts.map +1 -1
- package/dist/components/effects/HologramEffect.js +52 -23
- package/dist/components/effects/IceCrystalsEffect.d.ts +8 -3
- package/dist/components/effects/IceCrystalsEffect.d.ts.map +1 -1
- package/dist/components/effects/IceCrystalsEffect.js +36 -21
- package/dist/components/effects/IceHaloEffect.d.ts +7 -2
- package/dist/components/effects/IceHaloEffect.d.ts.map +1 -1
- package/dist/components/effects/IceHaloEffect.js +19 -9
- package/dist/components/effects/LichtenbergEffect.d.ts +7 -2
- package/dist/components/effects/LichtenbergEffect.d.ts.map +1 -1
- package/dist/components/effects/LichtenbergEffect.js +19 -9
- package/dist/components/effects/LightningEffect.d.ts +8 -3
- package/dist/components/effects/LightningEffect.d.ts.map +1 -1
- package/dist/components/effects/LightningEffect.js +54 -32
- package/dist/components/effects/MoleculesEffect.d.ts +8 -3
- package/dist/components/effects/MoleculesEffect.d.ts.map +1 -1
- package/dist/components/effects/MoleculesEffect.js +31 -21
- package/dist/components/effects/MurmurationEffect.d.ts +7 -2
- package/dist/components/effects/MurmurationEffect.d.ts.map +1 -1
- package/dist/components/effects/MurmurationEffect.js +19 -9
- package/dist/components/effects/NeuralNetworkEffect.d.ts +8 -3
- package/dist/components/effects/NeuralNetworkEffect.d.ts.map +1 -1
- package/dist/components/effects/NeuralNetworkEffect.js +66 -33
- package/dist/components/effects/OrbEffect.d.ts +8 -3
- package/dist/components/effects/OrbEffect.d.ts.map +1 -1
- package/dist/components/effects/OrbEffect.js +89 -42
- package/dist/components/effects/PlanetaryRingsEffect.d.ts +7 -2
- package/dist/components/effects/PlanetaryRingsEffect.d.ts.map +1 -1
- package/dist/components/effects/PlanetaryRingsEffect.js +19 -9
- package/dist/components/effects/PortalEffect.d.ts +8 -3
- package/dist/components/effects/PortalEffect.d.ts.map +1 -1
- package/dist/components/effects/PortalEffect.js +41 -25
- package/dist/components/effects/ShockwaveEffect.d.ts +7 -2
- package/dist/components/effects/ShockwaveEffect.d.ts.map +1 -1
- package/dist/components/effects/ShockwaveEffect.js +19 -9
- package/dist/components/effects/SmokePlumeEffect.d.ts +8 -3
- package/dist/components/effects/SmokePlumeEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokePlumeEffect.js +30 -20
- package/dist/components/effects/SmokeRibbon.d.ts +8 -2
- package/dist/components/effects/SmokeRibbon.d.ts.map +1 -1
- package/dist/components/effects/SmokeRibbon.js +34 -24
- package/dist/components/effects/SmokeRingEffect.d.ts +8 -3
- package/dist/components/effects/SmokeRingEffect.d.ts.map +1 -1
- package/dist/components/effects/SmokeRingEffect.js +33 -21
- package/dist/components/effects/StrangeAttractorEffect.d.ts +8 -3
- package/dist/components/effects/StrangeAttractorEffect.d.ts.map +1 -1
- package/dist/components/effects/StrangeAttractorEffect.js +30 -20
- package/dist/components/effects/VolumetricFogEffect.d.ts +8 -3
- package/dist/components/effects/VolumetricFogEffect.d.ts.map +1 -1
- package/dist/components/effects/VolumetricFogEffect.js +38 -20
- package/dist/components/effects/WaterCausticsEffect.d.ts +7 -2
- package/dist/components/effects/WaterCausticsEffect.d.ts.map +1 -1
- package/dist/components/effects/WaterCausticsEffect.js +19 -9
- package/dist/components/effects/index.d.ts +0 -1
- package/dist/components/effects/index.d.ts.map +1 -1
- package/dist/components/effects/index.js +0 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/components/landscape/LandscapeMesh.js +1 -1
- package/dist/components/landscape/types.d.ts +1 -1
- package/dist/components/landscape/types.d.ts.map +1 -1
- package/dist/components/particles/MagneticBottleParticles.d.ts +17 -0
- package/dist/components/particles/MagneticBottleParticles.d.ts.map +1 -0
- package/dist/components/particles/MagneticBottleParticles.js +618 -0
- package/dist/components/particles/ShapeBurstParticles.d.ts +17 -0
- package/dist/components/particles/ShapeBurstParticles.d.ts.map +1 -0
- package/dist/components/particles/ShapeBurstParticles.js +588 -0
- package/dist/components/particles/ShapeFlowParticles.d.ts +17 -0
- package/dist/components/particles/ShapeFlowParticles.d.ts.map +1 -0
- package/dist/components/particles/ShapeFlowParticles.js +755 -0
- package/dist/components/particles/index.d.ts +6 -0
- package/dist/components/particles/index.d.ts.map +1 -1
- package/dist/components/particles/index.js +3 -0
- package/dist/components/terrain/types.d.ts +1 -1
- package/dist/components/terrain/types.d.ts.map +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts +1 -1
- package/dist/components/volumetricClouds/VolumetricCloudsPass.d.ts.map +1 -1
- package/dist/components/volumetricClouds/types.d.ts +1 -1
- package/dist/components/volumetricClouds/types.d.ts.map +1 -1
- package/dist/components/water/types.d.ts +1 -1
- package/dist/components/water/types.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useConfigDriver.d.ts +22 -0
- package/dist/hooks/useConfigDriver.d.ts.map +1 -0
- package/dist/hooks/useConfigDriver.js +43 -0
- package/dist/hooks/useConfigLive.d.ts +1 -1
- package/dist/hooks/useConfigLive.d.ts.map +1 -1
- package/dist/hooks/useLandscapeMaps.d.ts +1 -1
- package/dist/hooks/useLandscapeMaps.d.ts.map +1 -1
- package/dist/hooks/useOceanMaterial.d.ts +1 -1
- package/dist/hooks/useThunder.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/interactions/index.d.ts +2 -1
- package/dist/interactions/index.d.ts.map +1 -1
- package/dist/interactions/index.js +1 -1
- package/dist/interactions/runner.d.ts +18 -3
- package/dist/interactions/runner.d.ts.map +1 -1
- package/dist/interactions/runner.js +25 -2
- package/dist/operations/catalogue/curlSmoke.d.ts +3 -0
- package/dist/operations/catalogue/curlSmoke.d.ts.map +1 -0
- package/dist/operations/catalogue/curlSmoke.js +178 -0
- package/dist/operations/catalogue/displayImage.d.ts.map +1 -1
- package/dist/operations/catalogue/displayImage.js +1 -0
- package/dist/operations/catalogue/dissolve.d.ts +3 -0
- package/dist/operations/catalogue/dissolve.d.ts.map +1 -0
- package/dist/operations/catalogue/dissolve.js +57 -0
- package/dist/operations/catalogue/emberAsh.d.ts +3 -0
- package/dist/operations/catalogue/emberAsh.d.ts.map +1 -0
- package/dist/operations/catalogue/emberAsh.js +171 -0
- package/dist/operations/catalogue/fade.d.ts.map +1 -1
- package/dist/operations/catalogue/fade.js +1 -0
- package/dist/operations/catalogue/flip.d.ts +3 -0
- package/dist/operations/catalogue/flip.d.ts.map +1 -0
- package/dist/operations/catalogue/flip.js +69 -0
- package/dist/operations/catalogue/flock.d.ts +3 -0
- package/dist/operations/catalogue/flock.d.ts.map +1 -0
- package/dist/operations/catalogue/flock.js +163 -0
- package/dist/operations/catalogue/focus.d.ts.map +1 -1
- package/dist/operations/catalogue/focus.js +1 -0
- package/dist/operations/catalogue/frame.d.ts +3 -0
- package/dist/operations/catalogue/frame.d.ts.map +1 -0
- package/dist/operations/catalogue/frame.js +44 -0
- package/dist/operations/catalogue/frost.d.ts +3 -0
- package/dist/operations/catalogue/frost.d.ts.map +1 -0
- package/dist/operations/catalogue/frost.js +111 -0
- package/dist/operations/catalogue/fxInstances.d.ts +21 -0
- package/dist/operations/catalogue/fxInstances.d.ts.map +1 -0
- package/dist/operations/catalogue/fxInstances.js +47 -0
- package/dist/operations/catalogue/fxPoints.d.ts +22 -0
- package/dist/operations/catalogue/fxPoints.d.ts.map +1 -0
- package/dist/operations/catalogue/fxPoints.js +70 -0
- package/dist/operations/catalogue/glow.d.ts.map +1 -1
- package/dist/operations/catalogue/glow.js +2 -1
- package/dist/operations/catalogue/heatCracks.d.ts +3 -0
- package/dist/operations/catalogue/heatCracks.d.ts.map +1 -0
- package/dist/operations/catalogue/heatCracks.js +134 -0
- package/dist/operations/catalogue/hologram.d.ts +3 -0
- package/dist/operations/catalogue/hologram.d.ts.map +1 -0
- package/dist/operations/catalogue/hologram.js +118 -0
- package/dist/operations/catalogue/inkBloom.d.ts +3 -0
- package/dist/operations/catalogue/inkBloom.d.ts.map +1 -0
- package/dist/operations/catalogue/inkBloom.js +156 -0
- package/dist/operations/catalogue/ivy.d.ts +13 -0
- package/dist/operations/catalogue/ivy.d.ts.map +1 -0
- package/dist/operations/catalogue/ivy.js +469 -0
- package/dist/operations/catalogue/jelly.d.ts +3 -0
- package/dist/operations/catalogue/jelly.d.ts.map +1 -0
- package/dist/operations/catalogue/jelly.js +50 -0
- package/dist/operations/catalogue/kintsugi.d.ts +3 -0
- package/dist/operations/catalogue/kintsugi.d.ts.map +1 -0
- package/dist/operations/catalogue/kintsugi.js +173 -0
- package/dist/operations/catalogue/lidarScan.d.ts +3 -0
- package/dist/operations/catalogue/lidarScan.d.ts.map +1 -0
- package/dist/operations/catalogue/lidarScan.js +240 -0
- package/dist/operations/catalogue/liquidMetal.d.ts +3 -0
- package/dist/operations/catalogue/liquidMetal.d.ts.map +1 -0
- package/dist/operations/catalogue/liquidMetal.js +122 -0
- package/dist/operations/catalogue/metalize.d.ts +3 -0
- package/dist/operations/catalogue/metalize.d.ts.map +1 -0
- package/dist/operations/catalogue/metalize.js +135 -0
- package/dist/operations/catalogue/moveToFront.d.ts.map +1 -1
- package/dist/operations/catalogue/moveToFront.js +1 -0
- package/dist/operations/catalogue/orbit.d.ts +3 -0
- package/dist/operations/catalogue/orbit.d.ts.map +1 -0
- package/dist/operations/catalogue/orbit.js +29 -0
- package/dist/operations/catalogue/particleSwarm.d.ts +3 -0
- package/dist/operations/catalogue/particleSwarm.d.ts.map +1 -0
- package/dist/operations/catalogue/particleSwarm.js +138 -0
- package/dist/operations/catalogue/petalPeel.d.ts +3 -0
- package/dist/operations/catalogue/petalPeel.d.ts.map +1 -0
- package/dist/operations/catalogue/petalPeel.js +137 -0
- package/dist/operations/catalogue/petrify.d.ts +3 -0
- package/dist/operations/catalogue/petrify.d.ts.map +1 -0
- package/dist/operations/catalogue/petrify.js +94 -0
- package/dist/operations/catalogue/portal.d.ts +3 -0
- package/dist/operations/catalogue/portal.d.ts.map +1 -0
- package/dist/operations/catalogue/portal.js +224 -0
- package/dist/operations/catalogue/print3d.d.ts +3 -0
- package/dist/operations/catalogue/print3d.d.ts.map +1 -0
- package/dist/operations/catalogue/print3d.js +275 -0
- package/dist/operations/catalogue/rainBeads.d.ts +3 -0
- package/dist/operations/catalogue/rainBeads.d.ts.map +1 -0
- package/dist/operations/catalogue/rainBeads.js +223 -0
- package/dist/operations/catalogue/restPose.d.ts +21 -0
- package/dist/operations/catalogue/restPose.d.ts.map +1 -0
- package/dist/operations/catalogue/restPose.js +55 -0
- package/dist/operations/catalogue/rimLight.d.ts +3 -0
- package/dist/operations/catalogue/rimLight.d.ts.map +1 -0
- package/dist/operations/catalogue/rimLight.js +72 -0
- package/dist/operations/catalogue/sandErosion.d.ts +3 -0
- package/dist/operations/catalogue/sandErosion.d.ts.map +1 -0
- package/dist/operations/catalogue/sandErosion.js +167 -0
- package/dist/operations/catalogue/shaderLayers.d.ts +74 -0
- package/dist/operations/catalogue/shaderLayers.d.ts.map +1 -0
- package/dist/operations/catalogue/shaderLayers.js +322 -0
- package/dist/operations/catalogue/shatter.d.ts +3 -0
- package/dist/operations/catalogue/shatter.d.ts.map +1 -0
- package/dist/operations/catalogue/shatter.js +267 -0
- package/dist/operations/catalogue/silkDrape.d.ts +3 -0
- package/dist/operations/catalogue/silkDrape.d.ts.map +1 -0
- package/dist/operations/catalogue/silkDrape.js +340 -0
- package/dist/operations/catalogue/spin.d.ts +3 -0
- package/dist/operations/catalogue/spin.d.ts.map +1 -0
- package/dist/operations/catalogue/spin.js +42 -0
- package/dist/operations/catalogue/surfaceSample.d.ts +17 -0
- package/dist/operations/catalogue/surfaceSample.d.ts.map +1 -0
- package/dist/operations/catalogue/surfaceSample.js +187 -0
- package/dist/operations/catalogue/swirl.d.ts +3 -0
- package/dist/operations/catalogue/swirl.d.ts.map +1 -0
- package/dist/operations/catalogue/swirl.js +69 -0
- package/dist/operations/catalogue/teleport.d.ts +3 -0
- package/dist/operations/catalogue/teleport.d.ts.map +1 -0
- package/dist/operations/catalogue/teleport.js +213 -0
- package/dist/operations/catalogue/transitionField.d.ts +124 -0
- package/dist/operations/catalogue/transitionField.d.ts.map +1 -0
- package/dist/operations/catalogue/transitionField.js +278 -0
- package/dist/operations/catalogue/unweave.d.ts +3 -0
- package/dist/operations/catalogue/unweave.d.ts.map +1 -0
- package/dist/operations/catalogue/unweave.js +233 -0
- package/dist/operations/catalogue/visibility.d.ts.map +1 -1
- package/dist/operations/catalogue/visibility.js +1 -0
- package/dist/operations/catalogue/voxelize.d.ts +3 -0
- package/dist/operations/catalogue/voxelize.d.ts.map +1 -0
- package/dist/operations/catalogue/voxelize.js +148 -0
- package/dist/operations/catalogue/warmup.d.ts +22 -0
- package/dist/operations/catalogue/warmup.d.ts.map +1 -0
- package/dist/operations/catalogue/warmup.js +106 -0
- package/dist/operations/catalogue/zoom.d.ts.map +1 -1
- package/dist/operations/catalogue/zoom.js +1 -0
- package/dist/operations/index.d.ts +4 -2
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +4 -2
- package/dist/operations/objectEffects.d.ts +46 -0
- package/dist/operations/objectEffects.d.ts.map +1 -0
- package/dist/operations/objectEffects.js +136 -0
- package/dist/operations/registry.d.ts +7 -2
- package/dist/operations/registry.d.ts.map +1 -1
- package/dist/operations/registry.js +45 -3
- package/dist/operations/runtime.d.ts +40 -2
- package/dist/operations/runtime.d.ts.map +1 -1
- package/dist/operations/runtime.js +164 -8
- package/dist/operations/types.d.ts +29 -3
- package/dist/operations/types.d.ts.map +1 -1
- package/dist/operations/types.js +6 -0
- package/dist/operations/useObjectEffectLayers.d.ts +4 -0
- package/dist/operations/useObjectEffectLayers.d.ts.map +1 -0
- package/dist/operations/useObjectEffectLayers.js +42 -0
- package/dist/operations/useOperationsRuntime.d.ts.map +1 -1
- package/dist/operations/useOperationsRuntime.js +42 -4
- package/dist/presets/landscapePresets.d.ts +1 -1
- package/dist/presets/landscapePresets.d.ts.map +1 -1
- package/dist/presets/landscapePresets.js +1 -1
- package/dist/presets/landscapeTypes.d.ts +1 -1
- package/dist/presets/landscapeTypes.d.ts.map +1 -1
- package/dist/presets/landscapeTypes.js +1 -1
- package/dist/presets/oceanSurfacePresets.d.ts +1 -1
- package/dist/presets/terrainPresets.d.ts +1 -1
- package/dist/presets/terrainPresets.d.ts.map +1 -1
- package/dist/presets/volumetricCloudPresets.d.ts +1 -1
- package/dist/types/cloudConfigs.d.ts +2 -309
- package/dist/types/cloudConfigs.d.ts.map +1 -1
- package/dist/types/cloudConfigs.js +2 -339
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -4
- package/dist/types/landscapeConfigs.d.ts +2 -217
- package/dist/types/landscapeConfigs.d.ts.map +1 -1
- package/dist/types/landscapeConfigs.js +2 -256
- package/dist/types/oceanConfigs.d.ts +2 -289
- package/dist/types/oceanConfigs.d.ts.map +1 -1
- package/dist/types/oceanConfigs.js +2 -380
- package/dist/types/terrainConfigs.d.ts +2 -250
- package/dist/types/terrainConfigs.d.ts.map +1 -1
- package/dist/types/terrainConfigs.js +2 -292
- package/dist/utils/cloudUniforms.d.ts +1 -1
- package/dist/utils/configAnimations.d.ts +6 -0
- package/dist/utils/configAnimations.d.ts.map +1 -1
- package/dist/utils/configAnimations.js +14 -0
- package/dist/utils/gridConfig.d.ts +19 -0
- package/dist/utils/gridConfig.d.ts.map +1 -0
- package/dist/utils/gridConfig.js +52 -0
- package/dist/utils/handleCloudsAnimations.d.ts +1 -1
- package/dist/utils/handleCloudsAnimations.js +1 -1
- package/dist/utils/hasHoverAnimation.d.ts.map +1 -1
- package/dist/utils/hasHoverAnimation.js +0 -2
- package/dist/utils/landscapeUniforms.d.ts +1 -1
- package/dist/utils/landscapeUniforms.d.ts.map +1 -1
- package/dist/utils/oceanUniforms.d.ts +1 -1
- package/dist/utils/particleShape.d.ts +33 -0
- package/dist/utils/particleShape.d.ts.map +1 -0
- package/dist/utils/particleShape.js +207 -0
- package/dist/utils/particleTrails.d.ts.map +1 -1
- package/dist/utils/particleTrails.js +29 -14
- package/dist/utils/terrainUniforms.d.ts +1 -1
- package/dist/utils/terrainUniforms.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
// Silk drape — the magician's reveal. A sheet of silk falls onto the object and
|
|
2
|
+
// drapes over its real shape (a Verlet cloth — stretch, shear and bend
|
|
3
|
+
// constraints — colliding with the object's own surface samples and the floor),
|
|
4
|
+
// settles, and then collapses flat as the object vanishes beneath it, before the
|
|
5
|
+
// silk itself fades away. Reverting is the reveal: the silk appears on the floor,
|
|
6
|
+
// the object rises under it, and the cloth lifts off and away.
|
|
7
|
+
// With Disappear off (always, as an object effect) it stays draped: the silk
|
|
8
|
+
// settles over the object and holds there (the veiled sculpture), breathing
|
|
9
|
+
// faintly as if in still air; reverting lifts it away.
|
|
10
|
+
// The simulation is baked once per object (in the background, a few frames per
|
|
11
|
+
// task — nothing freezes), then played back by progress, so it scrubs both ways.
|
|
12
|
+
// The silk is a lit MeshPhysical with sheen and a light clearcoat, a faint dye
|
|
13
|
+
// variation, and a soft dissolve at the ends.
|
|
14
|
+
import { gsap } from 'gsap';
|
|
15
|
+
import { BufferAttribute, BufferGeometry, Color, DoubleSide, Mesh, MeshPhysicalMaterial, Vector3 } from 'three';
|
|
16
|
+
import { defineOperation } from '../types.js';
|
|
17
|
+
import { GLSL_NOISE, addLayer } from './shaderLayers.js';
|
|
18
|
+
import { createFieldState, fieldUniforms, hideMeshes, localBounds, runProgress } from './transitionField.js';
|
|
19
|
+
import { mulberry32, sampleSurfaceCached } from './surfaceSample.js';
|
|
20
|
+
import { hideUntilWarm } from './warmup.js';
|
|
21
|
+
const P = 'Slk';
|
|
22
|
+
const KEY = 'silkDrape';
|
|
23
|
+
const STATE = '__opSilkDrape';
|
|
24
|
+
const R = 44; // cloth resolution (R × R particles)
|
|
25
|
+
const F = 150; // baked frames
|
|
26
|
+
const SUB = 4; // substeps per frame
|
|
27
|
+
const ITER = 4; // constraint iterations per substep
|
|
28
|
+
/** Timeline (progress = frame / F): the object vanishes at HIDE, the silk fades from FADE. */
|
|
29
|
+
const HIDE = 0.5;
|
|
30
|
+
const SHRINK_END = 0.64;
|
|
31
|
+
const FADE_IN = 0.07;
|
|
32
|
+
const FADE = 0.85;
|
|
33
|
+
/** Where the silk has settled over the object (before it vanishes) — the held pose. */
|
|
34
|
+
const DRAPED = 0.47;
|
|
35
|
+
const bakes = new WeakMap();
|
|
36
|
+
const tick = () => new Promise(r => setTimeout(r, 0));
|
|
37
|
+
/** Simulate the whole drape → collapse once, F frames of R×R positions (root-local). */
|
|
38
|
+
async function bakeDrape(target, size, softness, seed) {
|
|
39
|
+
const b = localBounds(target);
|
|
40
|
+
const bs = b.getSize(new Vector3()), c = b.getCenter(new Vector3());
|
|
41
|
+
const E = Math.max(bs.length(), 1e-3);
|
|
42
|
+
const sample = sampleSurfaceCached(target, 7000, 97);
|
|
43
|
+
const S0 = sample.position.slice(0, sample.count * 3), SN = sample.normal, NS = sample.count;
|
|
44
|
+
const S = new Float32Array(S0);
|
|
45
|
+
const rc = 0.03 * E, th = 0.011 * E, floorY = b.min.y + th * 0.4;
|
|
46
|
+
// collider grid (rebuilt when the object shrinks)
|
|
47
|
+
let grid = new Map();
|
|
48
|
+
const key = (x, y, z) => `${Math.floor(x / rc)},${Math.floor(y / rc)},${Math.floor(z / rc)}`;
|
|
49
|
+
const build = () => {
|
|
50
|
+
grid = new Map();
|
|
51
|
+
for (let i = 0; i < NS; i++) {
|
|
52
|
+
const k = key(S[i * 3], S[i * 3 + 1], S[i * 3 + 2]);
|
|
53
|
+
const l = grid.get(k);
|
|
54
|
+
if (l)
|
|
55
|
+
l.push(i);
|
|
56
|
+
else
|
|
57
|
+
grid.set(k, [i]);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
build();
|
|
61
|
+
// cloth: a square sheet above the object, turned a little so corners hang in points
|
|
62
|
+
const rnd = mulberry32(seed);
|
|
63
|
+
const L = (Math.max(bs.x, bs.z) * 1.1 + 1.05 * bs.y) * size;
|
|
64
|
+
const sp = L / (R - 1);
|
|
65
|
+
const yaw = 0.35 + rnd() * 0.3, cy = Math.cos(yaw), sy = Math.sin(yaw);
|
|
66
|
+
const N = R * R;
|
|
67
|
+
const pos = new Float32Array(N * 3), prev = new Float32Array(N * 3);
|
|
68
|
+
for (let j = 0; j < R; j++)
|
|
69
|
+
for (let i = 0; i < R; i++) {
|
|
70
|
+
const u = (i / (R - 1) - 0.5) * L, v = (j / (R - 1) - 0.5) * L;
|
|
71
|
+
const k = (j * R + i) * 3;
|
|
72
|
+
pos[k] = c.x + u * cy - v * sy;
|
|
73
|
+
pos[k + 1] = b.max.y + 0.12 * bs.y + (rnd() - 0.5) * sp * 0.05;
|
|
74
|
+
pos[k + 2] = c.z + u * sy + v * cy;
|
|
75
|
+
}
|
|
76
|
+
prev.set(pos);
|
|
77
|
+
// constraints: stretch, shear, bend
|
|
78
|
+
const cons = [];
|
|
79
|
+
const add = (a, bb, stiff) => {
|
|
80
|
+
const d = Math.hypot(pos[a * 3] - pos[bb * 3], pos[a * 3 + 1] - pos[bb * 3 + 1], pos[a * 3 + 2] - pos[bb * 3 + 2]);
|
|
81
|
+
cons.push(a, bb, d, stiff);
|
|
82
|
+
};
|
|
83
|
+
const bend = 0.05 + 0.4 * (1 - softness);
|
|
84
|
+
for (let j = 0; j < R; j++)
|
|
85
|
+
for (let i = 0; i < R; i++) {
|
|
86
|
+
const a = j * R + i;
|
|
87
|
+
if (i + 1 < R)
|
|
88
|
+
add(a, a + 1, 1);
|
|
89
|
+
if (j + 1 < R)
|
|
90
|
+
add(a, a + R, 1);
|
|
91
|
+
if (i + 1 < R && j + 1 < R) {
|
|
92
|
+
add(a, a + R + 1, 0.7);
|
|
93
|
+
add(a + 1, a + R, 0.7);
|
|
94
|
+
}
|
|
95
|
+
if (i + 2 < R)
|
|
96
|
+
add(a, a + 2, bend);
|
|
97
|
+
if (j + 2 < R)
|
|
98
|
+
add(a, a + 2 * R, bend);
|
|
99
|
+
}
|
|
100
|
+
const C = new Float32Array(cons);
|
|
101
|
+
const nc = cons.length / 4;
|
|
102
|
+
const g = 3.6 * E, dt = 1 / 60 / SUB, damp = 0.992;
|
|
103
|
+
const frames = new Float32Array(F * N * 3);
|
|
104
|
+
const anchor = new Vector3(c.x, b.min.y, c.z);
|
|
105
|
+
let lastK = 1;
|
|
106
|
+
for (let f = 0; f < F; f++) {
|
|
107
|
+
frames.set(pos, f * N * 3);
|
|
108
|
+
// the object shrinks away under the silk after it has settled
|
|
109
|
+
const t = f / (F - 1);
|
|
110
|
+
const x = Math.min(1, Math.max(0, (t - HIDE) / (SHRINK_END - HIDE)));
|
|
111
|
+
const k = 1 - x * x * (3 - 2 * x) * 0.985;
|
|
112
|
+
if (Math.abs(k - lastK) > 1e-4) {
|
|
113
|
+
for (let i = 0; i < NS; i++) {
|
|
114
|
+
S[i * 3] = anchor.x + (S0[i * 3] - anchor.x) * k;
|
|
115
|
+
S[i * 3 + 1] = anchor.y + (S0[i * 3 + 1] - anchor.y) * k;
|
|
116
|
+
S[i * 3 + 2] = anchor.z + (S0[i * 3 + 2] - anchor.z) * k;
|
|
117
|
+
}
|
|
118
|
+
build();
|
|
119
|
+
lastK = k;
|
|
120
|
+
}
|
|
121
|
+
for (let s = 0; s < SUB; s++) {
|
|
122
|
+
for (let p = 0; p < N; p++) {
|
|
123
|
+
const o = p * 3;
|
|
124
|
+
for (let a = 0; a < 3; a++) {
|
|
125
|
+
const v = (pos[o + a] - prev[o + a]) * damp;
|
|
126
|
+
prev[o + a] = pos[o + a];
|
|
127
|
+
pos[o + a] += v + (a === 1 ? -g * dt * dt : 0);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
for (let it = 0; it < ITER; it++) {
|
|
131
|
+
for (let q = 0; q < nc; q++) {
|
|
132
|
+
const a = C[q * 4] * 3, bb = C[q * 4 + 1] * 3, rest = C[q * 4 + 2], st = C[q * 4 + 3];
|
|
133
|
+
const dx = pos[bb] - pos[a], dy = pos[bb + 1] - pos[a + 1], dz = pos[bb + 2] - pos[a + 2];
|
|
134
|
+
const d = Math.sqrt(dx * dx + dy * dy + dz * dz) || 1e-9;
|
|
135
|
+
const m = ((d - rest) / d) * 0.5 * st;
|
|
136
|
+
pos[a] += dx * m;
|
|
137
|
+
pos[a + 1] += dy * m;
|
|
138
|
+
pos[a + 2] += dz * m;
|
|
139
|
+
pos[bb] -= dx * m;
|
|
140
|
+
pos[bb + 1] -= dy * m;
|
|
141
|
+
pos[bb + 2] -= dz * m;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// collide with the object (nearest surface sample, pushed out along its normal) and the floor
|
|
145
|
+
for (let p = 0; p < N; p++) {
|
|
146
|
+
const o = p * 3;
|
|
147
|
+
const px = pos[o], py = pos[o + 1], pz = pos[o + 2];
|
|
148
|
+
const gx = Math.floor(px / rc), gy = Math.floor(py / rc), gz = Math.floor(pz / rc);
|
|
149
|
+
let best = -1, bd = rc * rc;
|
|
150
|
+
for (let a = -1; a <= 1; a++)
|
|
151
|
+
for (let bb = -1; bb <= 1; bb++)
|
|
152
|
+
for (let cc = -1; cc <= 1; cc++) {
|
|
153
|
+
const l = grid.get(`${gx + a},${gy + bb},${gz + cc}`);
|
|
154
|
+
if (!l)
|
|
155
|
+
continue;
|
|
156
|
+
for (const i of l) {
|
|
157
|
+
const d = (S[i * 3] - px) ** 2 + (S[i * 3 + 1] - py) ** 2 + (S[i * 3 + 2] - pz) ** 2;
|
|
158
|
+
if (d < bd) {
|
|
159
|
+
bd = d;
|
|
160
|
+
best = i;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
let hit = false;
|
|
165
|
+
if (best >= 0) {
|
|
166
|
+
const nx = SN[best * 3], ny = SN[best * 3 + 1], nz = SN[best * 3 + 2];
|
|
167
|
+
const dn = (px - S[best * 3]) * nx + (py - S[best * 3 + 1]) * ny + (pz - S[best * 3 + 2]) * nz;
|
|
168
|
+
if (dn < th) {
|
|
169
|
+
const push = th - dn;
|
|
170
|
+
pos[o] += nx * push;
|
|
171
|
+
pos[o + 1] += ny * push;
|
|
172
|
+
pos[o + 2] += nz * push;
|
|
173
|
+
hit = true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (pos[o + 1] < floorY) {
|
|
177
|
+
pos[o + 1] = floorY;
|
|
178
|
+
hit = true;
|
|
179
|
+
}
|
|
180
|
+
if (hit) { // friction: silk clings where it touches
|
|
181
|
+
for (let a = 0; a < 3; a++)
|
|
182
|
+
prev[o + a] = pos[o + a] - (pos[o + a] - prev[o + a]) * 0.35;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (f % 6 === 5)
|
|
187
|
+
await tick();
|
|
188
|
+
}
|
|
189
|
+
return frames;
|
|
190
|
+
}
|
|
191
|
+
function clothGeometry() {
|
|
192
|
+
const geo = new BufferGeometry();
|
|
193
|
+
const N = R * R;
|
|
194
|
+
const uv = new Float32Array(N * 2);
|
|
195
|
+
for (let j = 0; j < R; j++)
|
|
196
|
+
for (let i = 0; i < R; i++) {
|
|
197
|
+
uv[(j * R + i) * 2] = i / (R - 1);
|
|
198
|
+
uv[(j * R + i) * 2 + 1] = j / (R - 1);
|
|
199
|
+
}
|
|
200
|
+
const idx = [];
|
|
201
|
+
for (let j = 0; j < R - 1; j++)
|
|
202
|
+
for (let i = 0; i < R - 1; i++) {
|
|
203
|
+
const a = j * R + i;
|
|
204
|
+
idx.push(a, a + R, a + 1, a + 1, a + R, a + R + 1);
|
|
205
|
+
}
|
|
206
|
+
geo.setAttribute('position', new BufferAttribute(new Float32Array(N * 3), 3));
|
|
207
|
+
geo.setAttribute('normal', new BufferAttribute(new Float32Array(N * 3), 3));
|
|
208
|
+
geo.setAttribute('uv', new BufferAttribute(uv, 2));
|
|
209
|
+
geo.setIndex(idx);
|
|
210
|
+
return geo;
|
|
211
|
+
}
|
|
212
|
+
/** Show the baked frame for the current progress (interpolated) and the object's visibility. */
|
|
213
|
+
function pose(target, s) {
|
|
214
|
+
if (!s.bake)
|
|
215
|
+
return;
|
|
216
|
+
const pr = Math.min(1, Math.max(0, s.field.progress.value));
|
|
217
|
+
const f = pr * (F - 1), f0 = Math.floor(f), f1 = Math.min(F - 1, f0 + 1), w = f - f0;
|
|
218
|
+
const N = R * R * 3;
|
|
219
|
+
const fr = s.bake.frames;
|
|
220
|
+
const attr = s.mesh.geometry.getAttribute('position');
|
|
221
|
+
const arr = attr.array;
|
|
222
|
+
for (let i = 0; i < N; i++)
|
|
223
|
+
arr[i] = fr[f0 * N + i] * (1 - w) + fr[f1 * N + i] * w;
|
|
224
|
+
attr.needsUpdate = true;
|
|
225
|
+
s.mesh.geometry.computeVertexNormals();
|
|
226
|
+
s.mesh.geometry.computeBoundingSphere();
|
|
227
|
+
s.fade.value = smooth(0, FADE_IN, pr) * (1 - smooth(FADE, 1, pr));
|
|
228
|
+
hideMeshes(target, KEY, pr >= HIDE);
|
|
229
|
+
}
|
|
230
|
+
const smooth = (a, b, x) => { const t = Math.min(1, Math.max(0, (x - a) / (b - a))); return t * t * (3 - 2 * t); };
|
|
231
|
+
export default defineOperation({
|
|
232
|
+
value: 'silkDrape',
|
|
233
|
+
label: 'Silk drape',
|
|
234
|
+
description: 'Drop a silk sheet over the targets; it drapes, then collapses as they vanish — reverting is the reveal: the silk lifts off and away',
|
|
235
|
+
channel: 'visual',
|
|
236
|
+
multi: true,
|
|
237
|
+
toggles: true,
|
|
238
|
+
usableIn: ['interaction', 'action', 'object'],
|
|
239
|
+
params: {
|
|
240
|
+
color: { type: 'color', label: 'Silk', default: '#6a0f24' },
|
|
241
|
+
sheen: { type: 'color', label: 'Sheen', default: '#e07a8e' },
|
|
242
|
+
size: { type: 'number', label: 'Sheet size', default: 1, min: 0.6, max: 1.8, step: 0.05, unit: '×' },
|
|
243
|
+
softness: { type: 'number', label: 'Softness', default: 0.7, min: 0, max: 1, step: 0.01, hint: 'Stiff taffeta → liquid silk' },
|
|
244
|
+
duration: { type: 'number', label: 'Duration', default: 5.5, min: 0.3, max: 16, step: 0.1, unit: 's' },
|
|
245
|
+
disappear: { type: 'boolean', label: 'Disappear', default: true, hint: 'Off: the silk stays draped over the object (it holds there)' },
|
|
246
|
+
},
|
|
247
|
+
objectParams: { disappear: false },
|
|
248
|
+
apply(target, p) {
|
|
249
|
+
const key = `${p.size}|${p.softness}`;
|
|
250
|
+
let st = target.userData[STATE];
|
|
251
|
+
if (!st) {
|
|
252
|
+
const field = createFieldState(target);
|
|
253
|
+
const color = { value: new Color() }, fade = { value: 0 }, air = { value: 0 };
|
|
254
|
+
const mat = new MeshPhysicalMaterial({
|
|
255
|
+
color: 0xffffff, roughness: 0.36, metalness: 0, sheen: 0.7, sheenRoughness: 0.4, side: DoubleSide,
|
|
256
|
+
specularIntensity: 0.8, clearcoat: 0.15, clearcoatRoughness: 0.4,
|
|
257
|
+
});
|
|
258
|
+
addLayer(mat, 'silkCloth', {
|
|
259
|
+
uniforms: { ...fieldUniforms(P, field), uSlkColor: color, uSlkFade: fade, uSlkAir: air },
|
|
260
|
+
common: `varying vec2 vSlkUv;\n${GLSL_NOISE}`,
|
|
261
|
+
vertex: /* glsl */ `
|
|
262
|
+
vSlkUv = uv;
|
|
263
|
+
// held: the silk breathes faintly, as if in still air
|
|
264
|
+
transformed += normal * (uSlkAir * uSlkExtent * 0.0022 * sin(uSlkTime * 1.4 + uv.x * 11.0 + uv.y * 7.0) * (0.5 + 0.5 * sin(uSlkTime * 0.6 + uv.y * 4.0)));`,
|
|
265
|
+
diffuse: /* glsl */ `
|
|
266
|
+
{
|
|
267
|
+
// soft dissolve at both ends of the run
|
|
268
|
+
float n = fxFbm(vec3(vSlkUv * 7.0, 1.3));
|
|
269
|
+
if (n > uSlkFade * 1.08) discard;
|
|
270
|
+
// a faint dye variation, like real silk
|
|
271
|
+
diffuseColor.rgb = uSlkColor * (0.94 + 0.12 * fxFbm(vec3(vSlkUv * 3.0, 7.0)));
|
|
272
|
+
}`,
|
|
273
|
+
}, { immediate: true });
|
|
274
|
+
const mesh = new Mesh(clothGeometry(), mat);
|
|
275
|
+
mesh.castShadow = true; // (no self-shadow: shadow acne on thin cloth)
|
|
276
|
+
mesh.frustumCulled = false;
|
|
277
|
+
mesh.userData.__opFxHelper = true;
|
|
278
|
+
mesh.raycast = () => { };
|
|
279
|
+
target.add(mesh);
|
|
280
|
+
hideUntilWarm(mesh);
|
|
281
|
+
st = { field, color, sheen: mat.sheenColor, fade, air, mesh, bake: null, ready: Promise.resolve(), key: '' };
|
|
282
|
+
target.userData[STATE] = st;
|
|
283
|
+
}
|
|
284
|
+
const s = st;
|
|
285
|
+
s.color.value.set(String(p.color));
|
|
286
|
+
s.sheen.set(String(p.sheen));
|
|
287
|
+
if (s.key !== key) {
|
|
288
|
+
s.key = key;
|
|
289
|
+
const cached = bakes.get(target);
|
|
290
|
+
if (cached?.key === key) {
|
|
291
|
+
s.bake = cached;
|
|
292
|
+
s.ready = Promise.resolve();
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
s.bake = null;
|
|
296
|
+
s.ready = bakeDrape(target, Number(p.size), Number(p.softness), 11).then(frames => {
|
|
297
|
+
const bk = { key, frames };
|
|
298
|
+
bakes.set(target, bk);
|
|
299
|
+
if (s.key === key)
|
|
300
|
+
s.bake = bk;
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
pose(target, s);
|
|
305
|
+
gsap.killTweensOf(s.air);
|
|
306
|
+
if (p.disappear === false) {
|
|
307
|
+
return runProgress(target, s.field, DRAPED, {
|
|
308
|
+
duration: Number(p.duration) * DRAPED, ease: 'none', ready: s.ready, hold: true,
|
|
309
|
+
onUpdate: () => pose(target, s),
|
|
310
|
+
onComplete: () => { pose(target, s); gsap.to(s.air, { value: 1, duration: 1.5, ease: 'power1.inOut' }); },
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
s.air.value = 0;
|
|
314
|
+
return runProgress(target, s.field, 1, {
|
|
315
|
+
duration: Number(p.duration), ease: 'none', ready: s.ready,
|
|
316
|
+
onUpdate: () => pose(target, s),
|
|
317
|
+
onComplete: () => { pose(target, s); s.mesh.visible = false; },
|
|
318
|
+
});
|
|
319
|
+
},
|
|
320
|
+
revert(target, p) {
|
|
321
|
+
const s = target.userData[STATE];
|
|
322
|
+
if (!s)
|
|
323
|
+
return;
|
|
324
|
+
s.mesh.visible = true;
|
|
325
|
+
gsap.killTweensOf(s.air);
|
|
326
|
+
s.air.value = 0;
|
|
327
|
+
return runProgress(target, s.field, 0, {
|
|
328
|
+
// from the held drape it only has that part of the timeline to play back
|
|
329
|
+
duration: Number(p.duration) * Math.max(0.05, s.field.progress.value), ease: 'none', ready: s.ready,
|
|
330
|
+
onUpdate: () => pose(target, s),
|
|
331
|
+
onComplete: () => {
|
|
332
|
+
hideMeshes(target, KEY, false);
|
|
333
|
+
s.mesh.removeFromParent();
|
|
334
|
+
s.mesh.geometry.dispose();
|
|
335
|
+
s.mesh.material.dispose();
|
|
336
|
+
delete target.userData[STATE];
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
},
|
|
340
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/spin.ts"],"names":[],"mappings":";AAWA,wBAkCG"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Spin — the target turns a whole number of times about one of its own local
|
|
2
|
+
// axes and lands exactly where it started. One-shot: triggering again spins again.
|
|
3
|
+
import { gsap } from 'gsap';
|
|
4
|
+
import { Quaternion, Vector3 } from 'three';
|
|
5
|
+
import { defineOperation } from '../types.js';
|
|
6
|
+
const KEY = '__opSpin';
|
|
7
|
+
const AXES = { x: new Vector3(1, 0, 0), y: new Vector3(0, 1, 0), z: new Vector3(0, 0, 1) };
|
|
8
|
+
export default defineOperation({
|
|
9
|
+
value: 'spin',
|
|
10
|
+
label: 'Spin',
|
|
11
|
+
description: 'Turn the target a full turn (or more) about its own axis, landing where it started',
|
|
12
|
+
channel: 'transform',
|
|
13
|
+
multi: true,
|
|
14
|
+
toggles: false,
|
|
15
|
+
usableIn: ['interaction', 'action'],
|
|
16
|
+
params: {
|
|
17
|
+
axis: { type: 'select', label: 'Axis', default: 'y', options: [{ value: 'y', label: 'Up (Y)' }, { value: 'x', label: 'Side (X)' }, { value: 'z', label: 'Front (Z)' }] },
|
|
18
|
+
turns: { type: 'number', label: 'Turns', default: 1, min: 1, max: 10, step: 1 },
|
|
19
|
+
reverse: { type: 'boolean', label: 'Reverse', default: false },
|
|
20
|
+
duration: { type: 'number', label: 'Duration', default: 1.2, min: 0.1, max: 20, step: 0.05, unit: 's' },
|
|
21
|
+
},
|
|
22
|
+
apply(target, p) {
|
|
23
|
+
// A spin already running is finished first, so the rest pose is never lost.
|
|
24
|
+
const running = target.userData[KEY];
|
|
25
|
+
if (running) {
|
|
26
|
+
gsap.killTweensOf(running.proxy);
|
|
27
|
+
target.quaternion.copy(running.rest);
|
|
28
|
+
}
|
|
29
|
+
const axis = AXES[String(p.axis)] ?? AXES.y;
|
|
30
|
+
const st = { rest: target.quaternion.clone(), proxy: { angle: 0 } };
|
|
31
|
+
target.userData[KEY] = st;
|
|
32
|
+
const turn = new Quaternion();
|
|
33
|
+
const turns = Math.max(1, Math.round(Number(p.turns)));
|
|
34
|
+
gsap.to(st.proxy, {
|
|
35
|
+
angle: (p.reverse ? -1 : 1) * turns * Math.PI * 2,
|
|
36
|
+
duration: Number(p.duration), ease: 'power2.inOut',
|
|
37
|
+
// rest · turn(axis, a) = a turn about the object's own axis
|
|
38
|
+
onUpdate: () => { target.quaternion.copy(st.rest).multiply(turn.setFromAxisAngle(axis, st.proxy.angle)); },
|
|
39
|
+
onComplete: () => { target.quaternion.copy(st.rest); delete target.userData[KEY]; },
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
export interface SurfaceSample {
|
|
3
|
+
count: number;
|
|
4
|
+
/** xyz root-local */
|
|
5
|
+
position: Float32Array;
|
|
6
|
+
/** xyz root-local, unit */
|
|
7
|
+
normal: Float32Array;
|
|
8
|
+
/** rgb linear */
|
|
9
|
+
color: Float32Array;
|
|
10
|
+
/** 4 independent 0..1 randoms per point */
|
|
11
|
+
random: Float32Array;
|
|
12
|
+
}
|
|
13
|
+
export declare function mulberry32(seed: number): () => number;
|
|
14
|
+
export declare function sampleSurface(root: Object3D, count: number, seed?: number): SurfaceSample;
|
|
15
|
+
/** sampleSurface, remembered per object — replaying an effect costs nothing. */
|
|
16
|
+
export declare function sampleSurfaceCached(root: Object3D, count: number, seed?: number): SurfaceSample;
|
|
17
|
+
//# sourceMappingURL=surfaceSample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceSample.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/surfaceSample.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAY,QAAQ,EAAW,MAAM,OAAO,CAAC;AAGzD,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,2BAA2B;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,iBAAiB;IACjB,KAAK,EAAE,YAAY,CAAC;IACpB,2CAA2C;IAC3C,MAAM,EAAE,YAAY,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,gBAQtC;AA0ED,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,aAAa,CAkDpF;AAwBD,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,aAAa,CAW1F"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// Surface sampling — particles that ARE the object's surface.
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// Samples points over every mesh of a target, area-weighted in world units, and
|
|
6
|
+
// returns them in the target's root-local space with their normal and the colour
|
|
7
|
+
// the surface has there:
|
|
8
|
+
// material colour × vertex colour × base-colour texture (read once, on the CPU,
|
|
9
|
+
// from a 256px copy; compressed / GPU-only textures fall back to the colour).
|
|
10
|
+
// Seeded, so the same object always breaks up the same way.
|
|
11
|
+
//
|
|
12
|
+
import { Color, Matrix3, Matrix4, SRGBColorSpace, Vector2, Vector3 } from 'three';
|
|
13
|
+
import { MeshSurfaceSampler } from 'three/examples/jsm/math/MeshSurfaceSampler.js';
|
|
14
|
+
export function mulberry32(seed) {
|
|
15
|
+
let a = seed >>> 0;
|
|
16
|
+
return () => {
|
|
17
|
+
a |= 0;
|
|
18
|
+
a = (a + 0x6d2b79f5) | 0;
|
|
19
|
+
let t = Math.imul(a ^ (a >>> 15), 1 | a);
|
|
20
|
+
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
|
21
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
// ---------------------------------------------------------------- texture reads
|
|
25
|
+
const texCache = new WeakMap();
|
|
26
|
+
function readTexture(tex) {
|
|
27
|
+
if (texCache.has(tex))
|
|
28
|
+
return texCache.get(tex);
|
|
29
|
+
let out = null;
|
|
30
|
+
try {
|
|
31
|
+
const img = tex.image;
|
|
32
|
+
const iw = img?.width, ih = img?.height;
|
|
33
|
+
if (iw && ih && typeof document !== 'undefined' && !tex.isCompressedTexture && !tex.isDataTexture) {
|
|
34
|
+
const w = Math.min(256, iw), h = Math.min(256, ih);
|
|
35
|
+
const canvas = document.createElement('canvas');
|
|
36
|
+
canvas.width = w;
|
|
37
|
+
canvas.height = h;
|
|
38
|
+
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
39
|
+
if (ctx) {
|
|
40
|
+
ctx.drawImage(img, 0, 0, w, h);
|
|
41
|
+
out = { data: ctx.getImageData(0, 0, w, h).data, w, h };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
out = null; // tainted / unsupported image — colour only
|
|
47
|
+
}
|
|
48
|
+
texCache.set(tex, out);
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
const _uv3 = new Vector3();
|
|
52
|
+
const _c = new Color();
|
|
53
|
+
function sampleTexture(tex, uv, target) {
|
|
54
|
+
const px = readTexture(tex);
|
|
55
|
+
if (!px)
|
|
56
|
+
return false;
|
|
57
|
+
tex.updateMatrix();
|
|
58
|
+
_uv3.set(uv.x, uv.y, 1).applyMatrix3(tex.matrix);
|
|
59
|
+
const u = _uv3.x - Math.floor(_uv3.x);
|
|
60
|
+
const v = _uv3.y - Math.floor(_uv3.y);
|
|
61
|
+
const x = Math.min(px.w - 1, Math.floor(u * px.w));
|
|
62
|
+
const y = Math.min(px.h - 1, Math.floor((tex.flipY ? 1 - v : v) * px.h));
|
|
63
|
+
const i = (y * px.w + x) * 4;
|
|
64
|
+
_c.setRGB(px.data[i] / 255, px.data[i + 1] / 255, px.data[i + 2] / 255, SRGBColorSpace);
|
|
65
|
+
target.multiply(_c);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
function materialOf(mesh, faceIndex) {
|
|
69
|
+
if (!Array.isArray(mesh.material))
|
|
70
|
+
return mesh.material;
|
|
71
|
+
const vi = faceIndex * 3;
|
|
72
|
+
const g = mesh.geometry.groups.find((gr) => vi >= gr.start && vi < gr.start + gr.count);
|
|
73
|
+
return mesh.material[g?.materialIndex ?? 0];
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------- sampling
|
|
76
|
+
/** Area of a mesh's geometry in root-local units (for the per-mesh share). */
|
|
77
|
+
function meshArea(geo, m) {
|
|
78
|
+
const pos = geo.getAttribute('position');
|
|
79
|
+
const idx = geo.index;
|
|
80
|
+
const tris = idx ? idx.count / 3 : pos.count / 3;
|
|
81
|
+
const a = new Vector3(), b = new Vector3(), c = new Vector3();
|
|
82
|
+
// Estimate on a stride so huge meshes stay cheap.
|
|
83
|
+
const stride = Math.max(1, Math.floor(tris / 4000));
|
|
84
|
+
let area = 0;
|
|
85
|
+
for (let t = 0; t < tris; t += stride) {
|
|
86
|
+
const i0 = idx ? idx.getX(t * 3) : t * 3, i1 = idx ? idx.getX(t * 3 + 1) : t * 3 + 1, i2 = idx ? idx.getX(t * 3 + 2) : t * 3 + 2;
|
|
87
|
+
a.fromBufferAttribute(pos, i0).applyMatrix4(m);
|
|
88
|
+
b.fromBufferAttribute(pos, i1).applyMatrix4(m);
|
|
89
|
+
c.fromBufferAttribute(pos, i2).applyMatrix4(m);
|
|
90
|
+
area += b.sub(a).cross(c.sub(a)).length() * 0.5;
|
|
91
|
+
}
|
|
92
|
+
return area * stride;
|
|
93
|
+
}
|
|
94
|
+
export function sampleSurface(root, count, seed = 1) {
|
|
95
|
+
root.updateWorldMatrix(true, true);
|
|
96
|
+
const rootInv = new Matrix4().copy(root.matrixWorld).invert();
|
|
97
|
+
const meshes = [];
|
|
98
|
+
root.traverse((c) => {
|
|
99
|
+
if (!c.isMesh || !c.geometry?.getAttribute('position') || c.userData?.__opFxHelper || !c.visible)
|
|
100
|
+
return;
|
|
101
|
+
const m = new Matrix4().multiplyMatrices(rootInv, c.matrixWorld);
|
|
102
|
+
meshes.push({ mesh: c, m, area: meshArea(c.geometry, m) });
|
|
103
|
+
});
|
|
104
|
+
const total = meshes.reduce((s, x) => s + x.area, 0) || 1;
|
|
105
|
+
const out = {
|
|
106
|
+
count, position: new Float32Array(count * 3), normal: new Float32Array(count * 3),
|
|
107
|
+
color: new Float32Array(count * 3), random: new Float32Array(count * 4),
|
|
108
|
+
};
|
|
109
|
+
const rnd = mulberry32(seed);
|
|
110
|
+
for (let i = 0; i < count * 4; i++)
|
|
111
|
+
out.random[i] = rnd();
|
|
112
|
+
if (!meshes.length)
|
|
113
|
+
return { ...out, count: 0 };
|
|
114
|
+
const p = new Vector3(), n = new Vector3(), col = new Color(), uv = new Vector2(), base = new Color();
|
|
115
|
+
const nm = new Matrix3();
|
|
116
|
+
let k = 0;
|
|
117
|
+
meshes.forEach((entry, mi) => {
|
|
118
|
+
const share = mi === meshes.length - 1 ? count - k : Math.round((entry.area / total) * count);
|
|
119
|
+
if (share <= 0)
|
|
120
|
+
return;
|
|
121
|
+
const sampler = new MeshSurfaceSampler(entry.mesh);
|
|
122
|
+
// seeded (setRandomGenerator exists at runtime but is missing from @types/three)
|
|
123
|
+
sampler.randomFunction = rnd;
|
|
124
|
+
sampler.build();
|
|
125
|
+
nm.getNormalMatrix(entry.m);
|
|
126
|
+
const geo = entry.mesh.geometry;
|
|
127
|
+
const hasColor = !!geo.getAttribute('color');
|
|
128
|
+
const hasUv = !!geo.getAttribute('uv');
|
|
129
|
+
for (let s = 0; s < share && k < count; s++, k++) {
|
|
130
|
+
const face = sampler.sampleFaceIndex(); // runtime API, missing from @types/three
|
|
131
|
+
sampler.sampleFace(face, p, n, hasColor ? col : undefined, hasUv ? uv : undefined);
|
|
132
|
+
p.applyMatrix4(entry.m);
|
|
133
|
+
n.applyMatrix3(nm).normalize();
|
|
134
|
+
const mat = materialOf(entry.mesh, face);
|
|
135
|
+
base.setRGB(1, 1, 1);
|
|
136
|
+
if (hasColor)
|
|
137
|
+
base.copy(col);
|
|
138
|
+
if (mat?.color)
|
|
139
|
+
base.multiply(mat.color);
|
|
140
|
+
if (hasUv && mat?.map)
|
|
141
|
+
sampleTexture(mat.map, uv, base);
|
|
142
|
+
p.toArray(out.position, k * 3);
|
|
143
|
+
n.toArray(out.normal, k * 3);
|
|
144
|
+
out.color[k * 3] = base.r;
|
|
145
|
+
out.color[k * 3 + 1] = base.g;
|
|
146
|
+
out.color[k * 3 + 2] = base.b;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
out.count = k;
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
// ---------------------------------------------------------------- cache
|
|
153
|
+
/**
|
|
154
|
+
* What a sample depends on: every visible mesh's geometry, material and placement
|
|
155
|
+
* relative to the root. Moving the whole object does not invalidate it.
|
|
156
|
+
*/
|
|
157
|
+
function signature(root) {
|
|
158
|
+
root.updateWorldMatrix(true, true);
|
|
159
|
+
const inv = new Matrix4().copy(root.matrixWorld).invert();
|
|
160
|
+
const m = new Matrix4();
|
|
161
|
+
const parts = [];
|
|
162
|
+
root.traverse((c) => {
|
|
163
|
+
if (!c.isMesh || c.userData?.__opFxHelper || !c.visible || !c.geometry)
|
|
164
|
+
return;
|
|
165
|
+
m.multiplyMatrices(inv, c.matrixWorld);
|
|
166
|
+
const mats = Array.isArray(c.material) ? c.material : [c.material];
|
|
167
|
+
parts.push(`${c.geometry.uuid}:${c.geometry.attributes.position?.version ?? 0}:${mats.map((x) => x?.uuid).join('/')}:${m.elements.map(e => e.toFixed(4)).join(',')}`);
|
|
168
|
+
});
|
|
169
|
+
return parts.join('|');
|
|
170
|
+
}
|
|
171
|
+
const sampleCache = new WeakMap();
|
|
172
|
+
/** sampleSurface, remembered per object — replaying an effect costs nothing. */
|
|
173
|
+
export function sampleSurfaceCached(root, count, seed = 1) {
|
|
174
|
+
const key = `${count}|${seed}|${signature(root)}`;
|
|
175
|
+
let byKey = sampleCache.get(root);
|
|
176
|
+
if (!byKey) {
|
|
177
|
+
byKey = new Map();
|
|
178
|
+
sampleCache.set(root, byKey);
|
|
179
|
+
}
|
|
180
|
+
let hit = byKey.get(key);
|
|
181
|
+
if (!hit) {
|
|
182
|
+
hit = sampleSurface(root, count, seed);
|
|
183
|
+
byKey.clear(); // one sample per object: the latest configuration
|
|
184
|
+
byKey.set(key, hit);
|
|
185
|
+
}
|
|
186
|
+
return hit;
|
|
187
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swirl.d.ts","sourceRoot":"","sources":["../../../src/operations/catalogue/swirl.ts"],"names":[],"mappings":";AAgCA,wBAwCG"}
|