@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
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import {
|
|
5
|
+
import { withConfigDefaults } from '../../utils/configAnimations.js';
|
|
6
|
+
import { DEFAULT_GENERATIVE_EFFECTS, EFFECTS_ANIMATABLE } from "@3driseai/3drise-core";
|
|
6
7
|
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
8
|
+
import { useConfigDriver } from '../../hooks/useConfigDriver.js';
|
|
7
9
|
// ── Seeded LCG RNG — deterministic, no Math.random ───────────────────────────
|
|
8
10
|
function makeRng(seed) {
|
|
9
11
|
let s = (seed * 1664525 + 1013904223) >>> 0;
|
|
@@ -55,22 +57,37 @@ const glowFrag = /* glsl */ `
|
|
|
55
57
|
}
|
|
56
58
|
`;
|
|
57
59
|
const FADE_DUR = 0.22;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
/** Knobs that rebuild the bolts (count, fractal depth): commit only, never live. */
|
|
61
|
+
const STRUCTURAL = ['boltCount', 'branchDepth'];
|
|
62
|
+
/** Knobs a keyframe or pointer binding may drive per frame — exactly what the push point applies. */
|
|
63
|
+
const ANIMATABLE = new Set(EFFECTS_ANIMATABLE.lightning.map((p) => p.value));
|
|
64
|
+
/** The single push point: every config knob that lives on a material reaches it here. */
|
|
65
|
+
function applyConfig(cols, glowMats, c) {
|
|
66
|
+
cols.core.set(c.color);
|
|
67
|
+
cols.glow.set(c.glowColor);
|
|
68
|
+
cols.glowVec.set(cols.glow.r, cols.glow.g, cols.glow.b);
|
|
69
|
+
for (const m of glowMats) {
|
|
70
|
+
m.uniforms.uPointSize.value = 6 * c.intensity;
|
|
71
|
+
m.uniforms.uOpacity.value = c.opacity * 0.12;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const LightningEffect = ({ boundingRadius, config, id, keyframes, mouseMove, onObjectReady, onObjectDispose }) => {
|
|
75
|
+
const cfg = useMemo(() => withConfigDefaults(DEFAULT_GENERATIVE_EFFECTS.lightning, config), [config]);
|
|
76
|
+
const { boltCount, branchDepth } = cfg;
|
|
61
77
|
const rootRef = useRef(null);
|
|
62
78
|
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
79
|
+
// the knobs read per frame (speed, intensity, opacity, strikeRadius), from the last merged config
|
|
80
|
+
const cur = useRef(cfg);
|
|
63
81
|
const requestedDepth = Number(branchDepth);
|
|
64
82
|
const depth = Number.isFinite(requestedDepth)
|
|
65
83
|
? Math.min(Math.max(Math.floor(requestedDepth), 2), 6)
|
|
66
84
|
: 2;
|
|
67
85
|
const N = Math.pow(2, depth) + 1; // vertex count: 5, 9, 17, 33, 65
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const sr = boundingRadius * strikeRadius;
|
|
72
|
-
// ── Compute origin/target for a bolt from a seed ───────────────────────────
|
|
86
|
+
// written by applyConfig, read when the bolts are recoloured
|
|
87
|
+
const cols = useMemo(() => ({ core: new THREE.Color(), glow: new THREE.Color(), glowVec: new THREE.Vector3() }), []);
|
|
88
|
+
// Compute origin/target for a bolt from a seed (the strike radius is read live)
|
|
73
89
|
function boltEndpoints(rng) {
|
|
90
|
+
const sr = boundingRadius * cur.current.strikeRadius;
|
|
74
91
|
const theta = rng() * Math.PI * 2;
|
|
75
92
|
const elev = 0.3 + rng() * 0.4; // horizontal spread of origin
|
|
76
93
|
return [
|
|
@@ -78,7 +95,7 @@ const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
78
95
|
new THREE.Vector3((rng() - 0.5) * boundingRadius * 0.4, (rng() - 0.5) * boundingRadius * 0.3, (rng() - 0.5) * boundingRadius * 0.4),
|
|
79
96
|
];
|
|
80
97
|
}
|
|
81
|
-
//
|
|
98
|
+
// Build line+point geometry from a point list
|
|
82
99
|
function makeGeos(pts, colBuf, brightBuf) {
|
|
83
100
|
const posArr = new Float32Array(N * 3);
|
|
84
101
|
for (let i = 0; i < pts.length && i < N; i++) {
|
|
@@ -94,7 +111,7 @@ const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
94
111
|
pointGeo.setAttribute('aBrightness', new THREE.BufferAttribute(brightBuf, 1));
|
|
95
112
|
return { lineGeo, pointGeo };
|
|
96
113
|
}
|
|
97
|
-
//
|
|
114
|
+
// Initialise bolts
|
|
98
115
|
const bolts = useMemo(() => {
|
|
99
116
|
return Array.from({ length: boltCount }, (_, bi) => {
|
|
100
117
|
const seed = bi * 997 + 1;
|
|
@@ -112,35 +129,44 @@ const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
112
129
|
});
|
|
113
130
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
114
131
|
}, [boltCount, depth, N]);
|
|
115
|
-
|
|
132
|
+
useEffect(() => () => bolts.forEach((b) => { b.lineGeo.dispose(); b.pointGeo.dispose(); }), [bolts]);
|
|
133
|
+
// Shared materials
|
|
116
134
|
const lineMat = useMemo(() => new THREE.LineBasicMaterial({
|
|
117
135
|
vertexColors: true,
|
|
118
136
|
transparent: true,
|
|
119
137
|
depthWrite: false,
|
|
120
138
|
blending: THREE.AdditiveBlending,
|
|
121
139
|
}), []);
|
|
140
|
+
useEffect(() => () => lineMat.dispose(), [lineMat]);
|
|
122
141
|
const glowMats = useMemo(() => bolts.map(() => new THREE.ShaderMaterial({
|
|
123
142
|
vertexShader: glowVert,
|
|
124
143
|
fragmentShader: glowFrag,
|
|
125
144
|
uniforms: {
|
|
126
|
-
uPointSize: { value: 6
|
|
127
|
-
uColor: { value: glowVec },
|
|
128
|
-
uOpacity: { value:
|
|
145
|
+
uPointSize: { value: 6 },
|
|
146
|
+
uColor: { value: cols.glowVec },
|
|
147
|
+
uOpacity: { value: 0.12 },
|
|
129
148
|
},
|
|
130
149
|
transparent: true,
|
|
131
150
|
depthWrite: false,
|
|
132
151
|
blending: THREE.AdditiveBlending,
|
|
133
|
-
})),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
152
|
+
})), [bolts, cols]);
|
|
153
|
+
useEffect(() => () => glowMats.forEach((m) => m.dispose()), [glowMats]);
|
|
154
|
+
const push = useCallback((merged) => {
|
|
155
|
+
cur.current = merged;
|
|
156
|
+
applyConfig(cols, glowMats, merged);
|
|
157
|
+
}, [cols, glowMats]);
|
|
158
|
+
useLayoutEffect(() => { push(cfg); }, [push, cfg]);
|
|
159
|
+
useConfigDriver({ rootRef, id, family: 'effects', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
|
|
160
|
+
// Recompute vertex colors from current progress
|
|
137
161
|
function refreshColors(bolt, overallScale) {
|
|
138
162
|
const { progress, points, colBuf, brightBuf, lineGeo, pointGeo } = bolt;
|
|
163
|
+
const intensity = cur.current.intensity;
|
|
164
|
+
const { core: coreCol, glow: glowCol } = cols;
|
|
139
165
|
const n = points.length;
|
|
140
166
|
for (let i = 0; i < n; i++) {
|
|
141
167
|
const t = i / (n - 1);
|
|
142
168
|
if (t > progress + 0.001) {
|
|
143
|
-
// Not yet reached
|
|
169
|
+
// Not yet reached - keep black (invisible with additive blend)
|
|
144
170
|
colBuf[i * 3] = colBuf[i * 3 + 1] = colBuf[i * 3 + 2] = 0;
|
|
145
171
|
brightBuf[i] = 0;
|
|
146
172
|
continue;
|
|
@@ -148,12 +174,12 @@ const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
148
174
|
const behind = progress - t; // 0 = at head
|
|
149
175
|
// Exponential trail: bright near head, fades behind
|
|
150
176
|
const trail = Math.exp(-behind * 7.0);
|
|
151
|
-
// Build-up: whole bolt intensifies as progress moves from 0
|
|
177
|
+
// Build-up: whole bolt intensifies as progress moves from 0->1
|
|
152
178
|
const buildUp = 0.3 + 0.7 * progress;
|
|
153
179
|
// Extra corona right at the head
|
|
154
180
|
const corona = Math.exp(-behind * behind * 220) * 3.0;
|
|
155
181
|
const totalBri = (trail * buildUp + corona) * intensity * overallScale;
|
|
156
|
-
// Color: glow color in body
|
|
182
|
+
// Color: glow color in body -> core (white-ish) at head corona
|
|
157
183
|
const headMix = Math.min(1, corona * 0.5);
|
|
158
184
|
colBuf[i * 3] = (glowCol.r + (coreCol.r - glowCol.r) * headMix) * totalBri;
|
|
159
185
|
colBuf[i * 3 + 1] = (glowCol.g + (coreCol.g - glowCol.g) * headMix) * totalBri;
|
|
@@ -163,7 +189,7 @@ const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
163
189
|
lineGeo.attributes.color.needsUpdate = true;
|
|
164
190
|
pointGeo.attributes.aBrightness.needsUpdate = true;
|
|
165
191
|
}
|
|
166
|
-
//
|
|
192
|
+
// Rebuild bolt shape with fresh fractal
|
|
167
193
|
function rebuildShape(bolt) {
|
|
168
194
|
bolt.seed++;
|
|
169
195
|
const rng = makeRng(bolt.seed);
|
|
@@ -182,6 +208,7 @@ const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
182
208
|
posP.needsUpdate = true;
|
|
183
209
|
}
|
|
184
210
|
useFrame((_, delta) => {
|
|
211
|
+
const { speed, opacity } = cur.current;
|
|
185
212
|
const dt = delta * speed;
|
|
186
213
|
bolts.forEach((bolt, bi) => {
|
|
187
214
|
switch (bolt.phase) {
|
|
@@ -208,7 +235,7 @@ const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
208
235
|
break;
|
|
209
236
|
case 'flash': {
|
|
210
237
|
bolt.timer -= delta;
|
|
211
|
-
// Flash: briefly crank overall brightness to 2
|
|
238
|
+
// Flash: briefly crank overall brightness to 2-3x for the "return stroke"
|
|
212
239
|
const flashBoost = 1.0 + Math.max(0, bolt.timer / 0.08) * 2.5;
|
|
213
240
|
refreshColors(bolt, flashBoost);
|
|
214
241
|
if (bolt.timer <= 0) {
|
|
@@ -232,15 +259,10 @@ const LightningEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
232
259
|
}
|
|
233
260
|
}
|
|
234
261
|
});
|
|
235
|
-
if (animations?.length) {
|
|
236
|
-
applyGenerativeAnimations(glowMats, animations, startValuesCacheRef.current, Date.now(), false);
|
|
237
|
-
}
|
|
238
262
|
});
|
|
239
|
-
//
|
|
263
|
+
// Render
|
|
240
264
|
// Use primitive to render THREE.Line (not THREE.LineSegments)
|
|
241
|
-
const lineObjects = useMemo(() => bolts.map(bolt => new THREE.Line(bolt.lineGeo, lineMat)),
|
|
242
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
243
|
-
[bolts, lineMat]);
|
|
265
|
+
const lineObjects = useMemo(() => bolts.map(bolt => new THREE.Line(bolt.lineGeo, lineMat)), [bolts, lineMat]);
|
|
244
266
|
return (_jsx("group", { ref: rootRef, children: lineObjects.map((lineObj, bi) => (_jsxs("group", { children: [_jsx("primitive", { object: lineObj }), _jsx("points", { geometry: bolts[bi].pointGeo, material: glowMats[bi] })] }, bi))) }));
|
|
245
267
|
};
|
|
246
268
|
export default LightningEffect;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import type { AnimationOptions,
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MoleculesConfig, AnimationOptions, MouseMoveDomain } from "@3driseai/3drise-core";
|
|
3
3
|
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
4
|
export interface MoleculesEffectProps extends ObjectReadyProps {
|
|
5
5
|
boundingRadius: number;
|
|
6
6
|
config: MoleculesConfig;
|
|
7
|
-
|
|
7
|
+
/** Scene object id of a standalone effect: the live-edit handle is found by it. */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Keyframes on this effect's config knobs (animations.effect.animations). */
|
|
10
|
+
keyframes?: AnimationOptions[];
|
|
11
|
+
/** Pointer bindings on this effect's config knobs (mouseMove.effect). */
|
|
12
|
+
mouseMove?: MouseMoveDomain;
|
|
8
13
|
}
|
|
9
14
|
declare const MoleculesEffect: React.FC<MoleculesEffectProps>;
|
|
10
15
|
export default MoleculesEffect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculesEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/MoleculesEffect.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MoleculesEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/MoleculesEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC1D,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,mFAAmF;IACnF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,yEAAyE;IACzE,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAqRD,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkFnD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import * as THREE from 'three';
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
4
3
|
import { useFrame } from '@react-three/fiber';
|
|
5
|
-
import
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { withConfigDefaults } from '../../utils/configAnimations.js';
|
|
6
|
+
import { DEFAULT_GENERATIVE_EFFECTS, EFFECTS_ANIMATABLE } from "@3driseai/3drise-core";
|
|
6
7
|
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
8
|
+
import { useConfigDriver } from '../../hooks/useConfigDriver.js';
|
|
7
9
|
/**
|
|
8
10
|
* A molecule drawn as quantum electron clouds.
|
|
9
11
|
*
|
|
@@ -252,11 +254,29 @@ const nucleusFrag = /* glsl */ `
|
|
|
252
254
|
gl_FragColor = vec4(col * g * uIntensity * uOpacity, g * uOpacity);
|
|
253
255
|
}
|
|
254
256
|
`;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
/** Knobs that rebuild the electron clouds or re-tilt the tumble axis: commit only, never live. */
|
|
258
|
+
const STRUCTURAL = ['atomCount', 'cloudDensity', 'randomizeAxes'];
|
|
259
|
+
/** Knobs a keyframe or pointer binding may drive per frame — exactly what applyConfig pushes. */
|
|
260
|
+
const ANIMATABLE = new Set(EFFECTS_ANIMATABLE.molecules.map((p) => p.value));
|
|
261
|
+
/** The single push point: every config knob reaches its uniform here. */
|
|
262
|
+
function applyConfig(u, c, bound) {
|
|
263
|
+
u.uSpeed.value = c.speed;
|
|
264
|
+
u.uBound.value = bound;
|
|
265
|
+
u.uIntensity.value = c.intensity;
|
|
266
|
+
u.uOpacity.value = c.opacity;
|
|
267
|
+
u.uColor.value.set(c.color);
|
|
268
|
+
u.uPhaseColor.value.set(c.phaseColor);
|
|
269
|
+
u.uBondColor.value.set(c.bondColor);
|
|
270
|
+
u.uOrbitRadius.value = c.orbitRadius;
|
|
271
|
+
u.uAtomSize.value = c.atomSize;
|
|
272
|
+
u.uShowBonds.value = c.showBonds ? 1 : 0;
|
|
273
|
+
u.uOrbital.value = c.orbital;
|
|
274
|
+
}
|
|
275
|
+
const MoleculesEffect = ({ boundingRadius, config, id, keyframes, mouseMove, onObjectReady, onObjectDispose }) => {
|
|
276
|
+
const cfg = useMemo(() => withConfigDefaults(DEFAULT_GENERATIVE_EFFECTS.molecules, config), [config]);
|
|
277
|
+
const { atomCount, cloudDensity, randomizeAxes } = cfg;
|
|
257
278
|
const rootRef = useRef(null);
|
|
258
279
|
const spinRef = useRef(null);
|
|
259
|
-
const animCache = useRef({});
|
|
260
280
|
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
261
281
|
// a standalone effect gets boundingRadius 1; guard against an empty host
|
|
262
282
|
const b = boundingRadius > 0 ? boundingRadius : 1;
|
|
@@ -294,22 +314,12 @@ const MoleculesEffect = ({ boundingRadius, config, animations, onObjectReady, on
|
|
|
294
314
|
useEffect(() => () => cloudGeometry.dispose(), [cloudGeometry]);
|
|
295
315
|
const quadGeometry = useMemo(() => new THREE.PlaneGeometry(1, 1), []);
|
|
296
316
|
useEffect(() => () => quadGeometry.dispose(), [quadGeometry]);
|
|
297
|
-
|
|
298
|
-
uniforms
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
uniforms.uColor.value.set(color);
|
|
303
|
-
uniforms.uPhaseColor.value.set(phaseColor);
|
|
304
|
-
uniforms.uBondColor.value.set(bondColor);
|
|
305
|
-
uniforms.uOrbitRadius.value = orbitRadius;
|
|
306
|
-
uniforms.uAtomSize.value = atomSize;
|
|
307
|
-
uniforms.uShowBonds.value = showBonds ? 1 : 0;
|
|
308
|
-
uniforms.uOrbital.value = orbital;
|
|
309
|
-
}, [uniforms, speed, b, intensity, opacity, color, phaseColor, bondColor, orbitRadius, atomSize, showBonds, orbital]);
|
|
317
|
+
const push = useCallback((merged) => {
|
|
318
|
+
applyConfig(uniforms, merged, b);
|
|
319
|
+
}, [uniforms, b]);
|
|
320
|
+
useLayoutEffect(() => { push(cfg); }, [push, cfg]);
|
|
321
|
+
useConfigDriver({ rootRef, id, family: 'effects', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
|
|
310
322
|
useFrame((_, delta) => {
|
|
311
|
-
if (animations?.length)
|
|
312
|
-
applyGenerativeAnimations(materials, animations, animCache.current, Date.now(), false);
|
|
313
323
|
const t = (uniforms.uTime.value += delta * uniforms.uSpeed.value);
|
|
314
324
|
if (spinRef.current)
|
|
315
325
|
spinRef.current.rotation.y = t * 0.15;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { AnimationOptions, MurmurationConfig } from '@3driseai/3drise-core';
|
|
2
|
+
import type { AnimationOptions, MurmurationConfig, MouseMoveDomain } from '@3driseai/3drise-core';
|
|
3
3
|
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
4
|
export interface MurmurationEffectProps extends ObjectReadyProps {
|
|
5
5
|
boundingRadius: number;
|
|
6
6
|
config: MurmurationConfig;
|
|
7
|
-
|
|
7
|
+
/** Scene object id of a standalone effect: the live-edit handle is found by it. */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Keyframes on this effect's config knobs (animations.effect.animations). */
|
|
10
|
+
keyframes?: AnimationOptions[];
|
|
11
|
+
/** Pointer bindings on this effect's config knobs (mouseMove.effect). */
|
|
12
|
+
mouseMove?: MouseMoveDomain;
|
|
8
13
|
/** True when the effect is attached to an object, so it can react to the host. */
|
|
9
14
|
hasHost?: boolean;
|
|
10
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MurmurationEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/MurmurationEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MurmurationEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/MurmurationEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAIxF,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIlG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,mFAAmF;IACnF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,yEAAyE;IACzE,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AA0dD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAqCvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
import { useFrame } from '@react-three/fiber';
|
|
5
|
-
import {
|
|
5
|
+
import { EFFECTS_ANIMATABLE } from '@3driseai/3drise-core';
|
|
6
|
+
import { withConfigDefaults } from '../../utils/configAnimations.js';
|
|
6
7
|
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
8
|
+
import { useConfigDriver } from '../../hooks/useConfigDriver.js';
|
|
7
9
|
/**
|
|
8
10
|
* A starling murmuration: thousands of boids with topological neighbours swirl around a drifting roost, folding into dense, wave-like sheets. Use for dusk, wildlife, flocking, atmospheric scenes.
|
|
9
11
|
*
|
|
@@ -499,7 +501,7 @@ function build(u, c, bound, env) {
|
|
|
499
501
|
dispose() { geo.dispose(); mat.dispose(); },
|
|
500
502
|
};
|
|
501
503
|
}
|
|
502
|
-
/**
|
|
504
|
+
/** A value for every knob: the base the renderer draws and keyframes interpolate from. */
|
|
503
505
|
const DEFAULTS = {
|
|
504
506
|
intensity: 1,
|
|
505
507
|
speed: 1,
|
|
@@ -512,27 +514,35 @@ const DEFAULTS = {
|
|
|
512
514
|
separation: 1,
|
|
513
515
|
birdSize: 1,
|
|
514
516
|
};
|
|
515
|
-
|
|
517
|
+
/** Knobs that rebuild the object: they change on commit, never through the live path. */
|
|
518
|
+
const STRUCTURAL = ['count'];
|
|
519
|
+
/** Knobs a keyframe or pointer binding may drive per frame — exactly what the push point applies. */
|
|
520
|
+
const ANIMATABLE = new Set(EFFECTS_ANIMATABLE.murmuration.map((p) => p.value));
|
|
521
|
+
const MurmurationEffect = ({ boundingRadius, config, id, keyframes, mouseMove, hasHost = false, onObjectReady, onObjectDispose }) => {
|
|
516
522
|
const rootRef = useRef(null);
|
|
517
|
-
const animCache = useRef({});
|
|
518
523
|
useObjectReady(rootRef, config, onObjectReady, onObjectDispose);
|
|
519
524
|
// a standalone effect gets boundingRadius 1
|
|
520
525
|
const b = boundingRadius > 0 ? boundingRadius : 1;
|
|
521
|
-
const cfg = useMemo(() => (
|
|
526
|
+
const cfg = useMemo(() => withConfigDefaults(DEFAULTS, config), [config]);
|
|
522
527
|
const env = useMemo(() => ({ hasHost: hasHost }), [hasHost]);
|
|
523
528
|
// uniforms outlive the objects, so keyframe animations survive a rebuild
|
|
524
529
|
const uniforms = useMemo(() => createUniforms(), []);
|
|
525
530
|
// rebuilt only when the host size or a structural knob changes
|
|
526
|
-
const instance = useMemo(() => build(uniforms,
|
|
531
|
+
const instance = useMemo(() => build(uniforms, cfg, b, env), [uniforms, b, env, cfg.count]);
|
|
527
532
|
useEffect(() => () => instance.dispose(), [instance]);
|
|
528
533
|
useLayoutEffect(() => {
|
|
529
534
|
applyConfig(uniforms, cfg, b, env);
|
|
530
535
|
instance.apply(cfg);
|
|
531
536
|
}, [instance, uniforms, cfg, b, env]);
|
|
537
|
+
// Committed config + live drag + keyframes + pointer, merged into the one push point
|
|
538
|
+
// (the uniforms, then the instance's own cheap per-config step).
|
|
539
|
+
const push = useCallback((merged) => {
|
|
540
|
+
applyConfig(uniforms, merged, b, env);
|
|
541
|
+
instance.apply(merged);
|
|
542
|
+
}, [instance, uniforms, b, env]);
|
|
543
|
+
useConfigDriver({ rootRef, id, family: 'effects', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
|
|
532
544
|
useFrame((state, delta) => {
|
|
533
545
|
instance.update(Math.min(delta, 0.1), state.camera);
|
|
534
|
-
if (animations?.length)
|
|
535
|
-
applyGenerativeAnimations(instance.materials, animations, animCache.current, Date.now(), false);
|
|
536
546
|
});
|
|
537
547
|
return (_jsx("group", { ref: rootRef, children: _jsx("primitive", { object: instance.object }) }));
|
|
538
548
|
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { NeuralNetworkConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
2
|
+
import type { NeuralNetworkConfig, AnimationOptions, MouseMoveDomain } from "@3driseai/3drise-core";
|
|
3
3
|
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
-
interface NeuralNetworkEffectProps extends ObjectReadyProps {
|
|
4
|
+
export interface NeuralNetworkEffectProps extends ObjectReadyProps {
|
|
5
5
|
boundingRadius: number;
|
|
6
6
|
config: NeuralNetworkConfig;
|
|
7
|
-
|
|
7
|
+
/** Scene object id of a standalone effect: the live-edit handle is found by it. */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Keyframes on this effect's config knobs (animations.effect.animations). */
|
|
10
|
+
keyframes?: AnimationOptions[];
|
|
11
|
+
/** Pointer bindings on this effect's config knobs (mouseMove.effect). */
|
|
12
|
+
mouseMove?: MouseMoveDomain;
|
|
8
13
|
}
|
|
9
14
|
declare const NeuralNetworkEffect: React.FC<NeuralNetworkEffectProps>;
|
|
10
15
|
export default NeuralNetworkEffect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeuralNetworkEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/NeuralNetworkEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NeuralNetworkEffect.d.ts","sourceRoot":"","sources":["../../../src/components/effects/NeuralNetworkEffect.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAC9D,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,mFAAmF;IACnF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,yEAAyE;IACzE,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAgED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAmK3D,CAAC;AACF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { useFrame } from '@react-three/fiber';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
|
-
import {
|
|
5
|
+
import { withConfigDefaults } from '../../utils/configAnimations.js';
|
|
6
|
+
import { DEFAULT_GENERATIVE_EFFECTS, EFFECTS_ANIMATABLE } from "@3driseai/3drise-core";
|
|
6
7
|
import { useObjectReady } from '../../hooks/useObjectReady.js';
|
|
8
|
+
import { useConfigDriver } from '../../hooks/useConfigDriver.js';
|
|
7
9
|
// Tight point sprites for electrical signals moving through the connections.
|
|
8
10
|
const pulseVert = /* glsl */ `
|
|
9
11
|
attribute float aBright;
|
|
@@ -32,19 +34,44 @@ const pulseFrag = /* glsl */ `
|
|
|
32
34
|
}
|
|
33
35
|
`;
|
|
34
36
|
const MAX_PULSES = 4;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
/** Knobs that rebuild the network: commit only, never live. */
|
|
38
|
+
const STRUCTURAL = ['nodeCount'];
|
|
39
|
+
/** Knobs a keyframe or pointer binding may drive per frame — exactly what the push point applies. */
|
|
40
|
+
const ANIMATABLE = new Set(EFFECTS_ANIMATABLE.neuralNetwork.map((p) => p.value));
|
|
41
|
+
const _color = new THREE.Color();
|
|
42
|
+
const EDGE_DIM = 0.06;
|
|
43
|
+
/** The single push point: every config knob reaches its uniform (or material) here. */
|
|
44
|
+
function applyConfig(s, c) {
|
|
45
|
+
_color.set(c.nodeColor);
|
|
46
|
+
s.nodeMat.color.copy(_color);
|
|
47
|
+
s.nodeMat.opacity = c.opacity * 0.55;
|
|
48
|
+
// edges are drawn in a dim copy of the node colour
|
|
49
|
+
const cols = s.edgeGeo.attributes.color;
|
|
50
|
+
for (let i = 0; i < cols.count; i++)
|
|
51
|
+
cols.setXYZ(i, _color.r * EDGE_DIM, _color.g * EDGE_DIM, _color.b * EDGE_DIM);
|
|
52
|
+
cols.needsUpdate = true;
|
|
53
|
+
_color.set(c.pulseColor);
|
|
54
|
+
const u = s.pulseMat.uniforms;
|
|
55
|
+
u.uColor.value.set(_color.r, _color.g, _color.b);
|
|
56
|
+
u.uSize.value = 7 * c.intensity;
|
|
57
|
+
u.uOpacity.value = c.opacity;
|
|
58
|
+
}
|
|
59
|
+
const NeuralNetworkEffect = ({ boundingRadius, config, id, keyframes, mouseMove, onObjectReady, onObjectDispose }) => {
|
|
60
|
+
const cfg = useMemo(() => withConfigDefaults(DEFAULT_GENERATIVE_EFFECTS.neuralNetwork, config), [config]);
|
|
61
|
+
const { nodeCount } = cfg;
|
|
38
62
|
const groupRef = useRef(null);
|
|
39
63
|
useObjectReady(groupRef, config, onObjectReady, onObjectDispose);
|
|
64
|
+
// the knobs read per frame (speed, orbitSpeed, signalSpeed, intensity), from the last merged config
|
|
65
|
+
const cur = useRef(cfg);
|
|
40
66
|
// Node orbit state
|
|
41
67
|
const orbitAngles = useRef(new Float32Array(0));
|
|
42
68
|
const pulses = useRef([]);
|
|
43
69
|
const nextPulse = useRef(0);
|
|
44
70
|
const r = boundingRadius * 1.35;
|
|
45
71
|
const N = Math.max(8, Math.min(nodeCount, 40));
|
|
72
|
+
// Built once per node count and host size; colours, sizes and opacity are pushed.
|
|
46
73
|
const scene = useMemo(() => {
|
|
47
|
-
//
|
|
74
|
+
// Node positions on Fibonacci sphere
|
|
48
75
|
const basePos = [];
|
|
49
76
|
const goldenAngle = Math.PI * (3 - Math.sqrt(5));
|
|
50
77
|
for (let i = 0; i < N; i++) {
|
|
@@ -53,12 +80,12 @@ const NeuralNetworkEffect = ({ boundingRadius, config, animations, onObjectReady
|
|
|
53
80
|
const phi = i * goldenAngle;
|
|
54
81
|
basePos.push(new THREE.Vector3(Math.cos(phi) * rad, y * r, Math.sin(phi) * rad));
|
|
55
82
|
}
|
|
56
|
-
// Orbit axes
|
|
83
|
+
// Orbit axes - random unit vectors
|
|
57
84
|
const orbitAxes = Array.from({ length: N }, () => new THREE.Vector3(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize());
|
|
58
85
|
const orbitSpeeds = Array.from({ length: N }, () => 0.4 + Math.random() * 0.6);
|
|
59
86
|
const angles = new Float32Array(N).map((_, i) => i * 0.7);
|
|
60
87
|
orbitAngles.current = angles;
|
|
61
|
-
//
|
|
88
|
+
// Edges - connect nearby pairs
|
|
62
89
|
const MAX_DIST = r * 0.85;
|
|
63
90
|
const edges = [];
|
|
64
91
|
const degree = new Int32Array(N);
|
|
@@ -74,42 +101,35 @@ const NeuralNetworkEffect = ({ boundingRadius, config, animations, onObjectReady
|
|
|
74
101
|
}
|
|
75
102
|
}
|
|
76
103
|
const edgeVerts = new Float32Array(edges.length * 6);
|
|
77
|
-
const edgeCols = new Float32Array(edges.length * 6);
|
|
78
|
-
const nc = new THREE.Color(nodeColor);
|
|
79
|
-
const DIM = 0.06;
|
|
80
104
|
for (let e = 0; e < edges.length; e++) {
|
|
81
105
|
const [a, b] = edges[e];
|
|
82
106
|
edgeVerts.set([basePos[a].x, basePos[a].y, basePos[a].z, basePos[b].x, basePos[b].y, basePos[b].z], e * 6);
|
|
83
|
-
edgeCols.set([nc.r * DIM, nc.g * DIM, nc.b * DIM, nc.r * DIM, nc.g * DIM, nc.b * DIM], e * 6);
|
|
84
107
|
}
|
|
85
108
|
const edgeGeo = new THREE.BufferGeometry();
|
|
86
109
|
edgeGeo.setAttribute('position', new THREE.BufferAttribute(edgeVerts, 3));
|
|
87
|
-
edgeGeo.setAttribute('color', new THREE.BufferAttribute(
|
|
110
|
+
edgeGeo.setAttribute('color', new THREE.BufferAttribute(new Float32Array(edges.length * 6), 3));
|
|
88
111
|
const edgeMat = new THREE.LineBasicMaterial({
|
|
89
112
|
vertexColors: true, transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
|
|
90
113
|
});
|
|
91
|
-
//
|
|
92
|
-
const nodeGeo = new THREE.SphereGeometry(0.055
|
|
93
|
-
const nc2 = new THREE.Color(nodeColor);
|
|
114
|
+
// Node instanced mesh (sized per instance by intensity, so the size can be driven)
|
|
115
|
+
const nodeGeo = new THREE.SphereGeometry(0.055, 8, 8);
|
|
94
116
|
const nodeMat = new THREE.MeshBasicMaterial({
|
|
95
|
-
|
|
96
|
-
depthWrite: false, blending: THREE.AdditiveBlending,
|
|
117
|
+
transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
|
|
97
118
|
});
|
|
98
119
|
const nodeMesh = new THREE.InstancedMesh(nodeGeo, nodeMat, N);
|
|
99
120
|
nodeMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage);
|
|
100
|
-
//
|
|
121
|
+
// Pulse sprites
|
|
101
122
|
const pulsePos = new Float32Array(MAX_PULSES * 3);
|
|
102
123
|
const pulseBright = new Float32Array(MAX_PULSES);
|
|
103
124
|
const pulseGeo = new THREE.BufferGeometry();
|
|
104
125
|
pulseGeo.setAttribute('position', new THREE.BufferAttribute(pulsePos, 3));
|
|
105
126
|
pulseGeo.setAttribute('aBright', new THREE.BufferAttribute(pulseBright, 1));
|
|
106
|
-
const pc = new THREE.Color(pulseColor);
|
|
107
127
|
const pulseMat = new THREE.ShaderMaterial({
|
|
108
128
|
vertexShader: pulseVert, fragmentShader: pulseFrag,
|
|
109
129
|
uniforms: {
|
|
110
|
-
uSize: { value: 7
|
|
111
|
-
uColor: { value: new THREE.Vector3(
|
|
112
|
-
uOpacity: { value:
|
|
130
|
+
uSize: { value: 7 },
|
|
131
|
+
uColor: { value: new THREE.Vector3(1, 1, 1) },
|
|
132
|
+
uOpacity: { value: 1 },
|
|
113
133
|
},
|
|
114
134
|
transparent: true, depthWrite: false, blending: THREE.AdditiveBlending,
|
|
115
135
|
});
|
|
@@ -117,17 +137,34 @@ const NeuralNetworkEffect = ({ boundingRadius, config, animations, onObjectReady
|
|
|
117
137
|
pulses.current = Array.from({ length: MAX_PULSES }, () => ({
|
|
118
138
|
fromIdx: 0, toIdx: 1, progress: 0, active: false,
|
|
119
139
|
}));
|
|
120
|
-
return { basePos, orbitAxes, orbitSpeeds, edges, edgeGeo, edgeMat, nodeMesh, pulseGeo, pulseMat };
|
|
121
|
-
|
|
122
|
-
|
|
140
|
+
return { basePos, orbitAxes, orbitSpeeds, edges, edgeGeo, edgeMat, nodeGeo, nodeMat, nodeMesh, pulseGeo, pulseMat };
|
|
141
|
+
}, [N, r]);
|
|
142
|
+
useEffect(() => () => {
|
|
143
|
+
scene.edgeGeo.dispose();
|
|
144
|
+
scene.edgeMat.dispose();
|
|
145
|
+
scene.nodeGeo.dispose();
|
|
146
|
+
scene.nodeMat.dispose();
|
|
147
|
+
scene.nodeMesh.dispose();
|
|
148
|
+
scene.pulseGeo.dispose();
|
|
149
|
+
scene.pulseMat.dispose();
|
|
150
|
+
}, [scene]);
|
|
151
|
+
const push = useCallback((merged) => {
|
|
152
|
+
cur.current = merged;
|
|
153
|
+
applyConfig(scene, merged);
|
|
154
|
+
}, [scene]);
|
|
155
|
+
useLayoutEffect(() => { push(cfg); }, [push, cfg]);
|
|
156
|
+
useConfigDriver({ rootRef: groupRef, id, family: 'effects', base: cfg, structural: STRUCTURAL, allowed: ANIMATABLE, keyframes, mouseMove, push });
|
|
123
157
|
const tmpMat = useMemo(() => new THREE.Matrix4(), []);
|
|
124
158
|
const tmpQuat = useMemo(() => new THREE.Quaternion(), []);
|
|
125
159
|
const tmpVec = useMemo(() => new THREE.Vector3(), []);
|
|
160
|
+
const tmpScale = useMemo(() => new THREE.Vector3(), []);
|
|
126
161
|
useFrame((_, delta) => {
|
|
127
162
|
if (!groupRef.current)
|
|
128
163
|
return;
|
|
164
|
+
const { speed, orbitSpeed, signalSpeed, intensity } = cur.current;
|
|
129
165
|
const dt = delta * speed;
|
|
130
|
-
const { basePos, orbitAxes, orbitSpeeds, edges, edgeGeo, nodeMesh, pulseGeo
|
|
166
|
+
const { basePos, orbitAxes, orbitSpeeds, edges, edgeGeo, nodeMesh, pulseGeo } = scene;
|
|
167
|
+
tmpScale.setScalar(intensity);
|
|
131
168
|
// Rotate nodes around their individual axes
|
|
132
169
|
const angles = orbitAngles.current;
|
|
133
170
|
const curPos = [];
|
|
@@ -141,7 +178,7 @@ const NeuralNetworkEffect = ({ boundingRadius, config, animations, onObjectReady
|
|
|
141
178
|
const dot = base.dot(axis);
|
|
142
179
|
tmpVec.set(base.x * cosA + (axis.y * base.z - axis.z * base.y) * sinA + axis.x * dot * (1 - cosA), base.y * cosA + (axis.z * base.x - axis.x * base.z) * sinA + axis.y * dot * (1 - cosA), base.z * cosA + (axis.x * base.y - axis.y * base.x) * sinA + axis.z * dot * (1 - cosA));
|
|
143
180
|
curPos.push(tmpVec.clone());
|
|
144
|
-
tmpMat.compose(tmpVec, tmpQuat,
|
|
181
|
+
tmpMat.compose(tmpVec, tmpQuat, tmpScale);
|
|
145
182
|
nodeMesh.setMatrixAt(i, tmpMat);
|
|
146
183
|
}
|
|
147
184
|
nodeMesh.instanceMatrix.needsUpdate = true;
|
|
@@ -156,7 +193,7 @@ const NeuralNetworkEffect = ({ boundingRadius, config, animations, onObjectReady
|
|
|
156
193
|
// Pulse signals along edges
|
|
157
194
|
nextPulse.current -= delta;
|
|
158
195
|
if (nextPulse.current <= 0 && edges.length > 0) {
|
|
159
|
-
nextPulse.current = 0.4 / speed;
|
|
196
|
+
nextPulse.current = 0.4 / Math.max(speed, 0.05);
|
|
160
197
|
const idle = pulses.current.findIndex(p => !p.active);
|
|
161
198
|
if (idle >= 0) {
|
|
162
199
|
const e = Math.floor(Math.random() * edges.length);
|
|
@@ -182,10 +219,6 @@ const NeuralNetworkEffect = ({ boundingRadius, config, animations, onObjectReady
|
|
|
182
219
|
});
|
|
183
220
|
ptPos.needsUpdate = true;
|
|
184
221
|
ptBright.needsUpdate = true;
|
|
185
|
-
pulseMat.uniforms.uSize.value = 7 * intensity;
|
|
186
|
-
if (animations?.length) {
|
|
187
|
-
applyGenerativeAnimations([pulseMat], animations, startValuesCacheRef.current, Date.now(), false);
|
|
188
|
-
}
|
|
189
222
|
});
|
|
190
223
|
return (_jsxs("group", { ref: groupRef, children: [_jsx("lineSegments", { geometry: scene.edgeGeo, material: scene.edgeMat }), _jsx("primitive", { object: scene.nodeMesh }), _jsx("points", { geometry: scene.pulseGeo, material: scene.pulseMat })] }));
|
|
191
224
|
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { OrbConfig, AnimationOptions } from "@3driseai/3drise-core";
|
|
2
|
+
import type { OrbConfig, AnimationOptions, MouseMoveDomain } from "@3driseai/3drise-core";
|
|
3
3
|
import type { ObjectReadyProps } from '../../types/objectReady';
|
|
4
|
-
interface OrbEffectProps extends ObjectReadyProps {
|
|
4
|
+
export interface OrbEffectProps extends ObjectReadyProps {
|
|
5
5
|
boundingRadius: number;
|
|
6
6
|
config: OrbConfig;
|
|
7
|
-
|
|
7
|
+
/** Scene object id of a standalone effect: the live-edit handle is found by it. */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Keyframes on this effect's config knobs (animations.effect.animations). */
|
|
10
|
+
keyframes?: AnimationOptions[];
|
|
11
|
+
/** Pointer bindings on this effect's config knobs (mouseMove.effect). */
|
|
12
|
+
mouseMove?: MouseMoveDomain;
|
|
8
13
|
}
|
|
9
14
|
declare const OrbEffect: React.FC<OrbEffectProps>;
|
|
10
15
|
export default OrbEffect;
|